1919
2020from .common import validate_is_float
2121from .const import (
22+ ATTR_BATTERY_LAST_REPLACED ,
2223 ATTR_BATTERY_LEVEL ,
2324 ATTR_BATTERY_LOW ,
2425 ATTR_BATTERY_QUANTITY ,
@@ -147,6 +148,7 @@ def battery_low_template_state(self, value):
147148 ATTR_BATTERY_QUANTITY : self .battery_quantity ,
148149 ATTR_BATTERY_LEVEL : 0 ,
149150 ATTR_PREVIOUS_BATTERY_LEVEL : 100 ,
151+ ATTR_BATTERY_LAST_REPLACED : self .last_replaced ,
150152 ATTR_BATTERY_THRESHOLD_REMINDER : False ,
151153 },
152154 )
@@ -171,6 +173,7 @@ def battery_low_template_state(self, value):
171173 ATTR_BATTERY_QUANTITY : self .battery_quantity ,
172174 ATTR_BATTERY_LEVEL : 100 ,
173175 ATTR_PREVIOUS_BATTERY_LEVEL : 0 ,
176+ ATTR_BATTERY_LAST_REPLACED : self .last_replaced ,
174177 },
175178 )
176179
@@ -200,6 +203,7 @@ def battery_low_binary_state(self, value):
200203 ATTR_BATTERY_QUANTITY : self .battery_quantity ,
201204 ATTR_BATTERY_LEVEL : 0 ,
202205 ATTR_PREVIOUS_BATTERY_LEVEL : 100 ,
206+ ATTR_BATTERY_LAST_REPLACED : self .last_replaced ,
203207 ATTR_BATTERY_THRESHOLD_REMINDER : False ,
204208 },
205209 )
@@ -225,6 +229,7 @@ def battery_low_binary_state(self, value):
225229 ATTR_BATTERY_QUANTITY : self .battery_quantity ,
226230 ATTR_BATTERY_LEVEL : 100 ,
227231 ATTR_PREVIOUS_BATTERY_LEVEL : 0 ,
232+ ATTR_BATTERY_LAST_REPLACED : self .last_replaced ,
228233 },
229234 )
230235
@@ -273,6 +278,7 @@ def current_battery_level(self, value):
273278 ATTR_BATTERY_QUANTITY : self .battery_quantity ,
274279 ATTR_BATTERY_LEVEL : self .rounded_battery_level ,
275280 ATTR_PREVIOUS_BATTERY_LEVEL : self .rounded_previous_battery_level ,
281+ ATTR_BATTERY_LAST_REPLACED : self .last_replaced ,
276282 ATTR_BATTERY_THRESHOLD_REMINDER : False ,
277283 },
278284 )
@@ -306,6 +312,7 @@ def current_battery_level(self, value):
306312 ATTR_BATTERY_QUANTITY : self .battery_quantity ,
307313 ATTR_BATTERY_LEVEL : self .rounded_battery_level ,
308314 ATTR_PREVIOUS_BATTERY_LEVEL : self .rounded_previous_battery_level ,
315+ ATTR_BATTERY_LAST_REPLACED : self .last_replaced ,
309316 },
310317 )
311318
0 commit comments