File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
custom_components/battery_notes Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,11 @@ def battery_low_binary_state(self):
202
202
def battery_low_binary_state (self , value ):
203
203
"""Set the current battery low status from a binary sensor and fire events if valid."""
204
204
self ._battery_low_binary_state = value
205
- if self ._previous_battery_low_binary_state is not None :
205
+ if (self ._previous_battery_low_binary_state is not None
206
+ and value not in [
207
+ STATE_UNAVAILABLE ,
208
+ STATE_UNKNOWN ,
209
+ ]):
206
210
self .hass .bus .async_fire (
207
211
EVENT_BATTERY_THRESHOLD ,
208
212
{
@@ -229,6 +233,10 @@ def battery_low_binary_state(self, value):
229
233
if (
230
234
self ._previous_battery_low_binary_state
231
235
and not self ._battery_low_binary_state
236
+ and value not in [
237
+ STATE_UNAVAILABLE ,
238
+ STATE_UNKNOWN ,
239
+ ]
232
240
):
233
241
self .hass .bus .async_fire (
234
242
EVENT_BATTERY_INCREASED ,
You can’t perform that action at this time.
0 commit comments