File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
custom_components/battery_notes Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,10 @@ def battery_low_template_state(self, value):
136
136
if (
137
137
self ._previous_battery_low_template_state is not None
138
138
and self .battery_low_template
139
+ and value not in [
140
+ STATE_UNAVAILABLE ,
141
+ STATE_UNKNOWN ,
142
+ ]
139
143
):
140
144
self .hass .bus .async_fire (
141
145
EVENT_BATTERY_THRESHOLD ,
@@ -162,6 +166,10 @@ def battery_low_template_state(self, value):
162
166
if (
163
167
self ._previous_battery_low_template_state
164
168
and not self ._battery_low_template_state
169
+ and value not in [
170
+ STATE_UNAVAILABLE ,
171
+ STATE_UNKNOWN ,
172
+ ]
165
173
):
166
174
self .hass .bus .async_fire (
167
175
EVENT_BATTERY_INCREASED ,
@@ -182,7 +190,13 @@ def battery_low_template_state(self, value):
182
190
183
191
_LOGGER .debug ("battery_increased event fired via template" )
184
192
185
- self ._previous_battery_low_template_state = value
193
+ if value not in [
194
+ STATE_UNAVAILABLE ,
195
+ STATE_UNKNOWN ,
196
+ ]:
197
+ self ._previous_battery_low_template_state = value
198
+ else :
199
+ self ._previous_battery_low_template_state = None
186
200
187
201
@property
188
202
def battery_low_binary_state (self ):
You can’t perform that action at this time.
0 commit comments