File tree Expand file tree Collapse file tree 5 files changed +9
-9
lines changed
Expand file tree Collapse file tree 5 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 258258]
259259
260260BinarySensorType = Literal [
261- "battery_state" ,
262261 "compressor_state" ,
263262 "cooling_enabled" ,
264263 "cooling_state" ,
265264 "dhw_state" ,
266265 "flame_state" ,
267266 "heating_state" ,
267+ "low_battery" ,
268268 "plugwise_notification" ,
269269 "secondary_boiler_state" ,
270270]
@@ -410,13 +410,13 @@ class ModelData(TypedDict):
410410class SmileBinarySensors (TypedDict , total = False ):
411411 """Smile Binary Sensors class."""
412412
413- battery_state : bool
414413 compressor_state : bool
415414 cooling_enabled : bool
416415 cooling_state : bool
417416 dhw_state : bool
418417 flame_state : bool
419418 heating_state : bool
419+ low_battery : bool
420420 plugwise_notification : bool
421421 secondary_boiler_state : bool
422422
Original file line number Diff line number Diff line change @@ -65,22 +65,22 @@ def _update_gw_devices(self) -> None:
6565
6666 is_battery_low = (
6767 mac_list
68- and "battery_state " in device ["binary_sensors" ]
68+ and "low_battery " in device ["binary_sensors" ]
6969 and device ["zigbee_mac_address" ] in mac_list
7070 and (
7171 (device ["dev_class" ] in ("thermo_sensor" , "thermostatic_radiator_valve" ) and device ["sensors" ]["battery" ] < 30 )
7272 or (device ["dev_class" ] in ("zone_thermometer" , "zone_thermostat" ) and device ["sensors" ]["battery" ] < 15 )
7373 )
7474 )
7575 if is_battery_low :
76- device ["binary_sensors" ]["battery_state " ] = True
76+ device ["binary_sensors" ]["low_battery " ] = True
7777
7878 self ._update_for_cooling (device )
7979
8080 remove_empty_platform_dicts (device )
8181
8282 def _detect_low_batteries (self ) -> list [str ]:
83- """Helper-function updating the battery_state binary_sensor status from a Battery-is-low message."""
83+ """Helper-function updating the low-battery binary_sensor status from a Battery-is-low message."""
8484 mac_address_list : list [str ] = []
8585 mac_pattern = re .compile (r"(?:[0-9A-F]{2}){8}" )
8686 matches = ["Battery" , "below" ]
Original file line number Diff line number Diff line change @@ -139,7 +139,7 @@ def common_match_cases(
139139 data [sp_key ] = value
140140
141141 if "battery" in data ["sensors" ]:
142- data ["binary_sensors" ]["battery_state " ] = False
142+ data ["binary_sensors" ]["low_battery " ] = False
143143
144144
145145def escape_illegal_xml_characters (xmldata : str ) -> str :
Original file line number Diff line number Diff line change 7171 "zigbee_mac_address" : " 000D6F000C869B61" ,
7272 "vendor" : " Plugwise" ,
7373 "binary_sensors" : {
74- "battery_state " : true
74+ "low_battery " : true
7575 },
7676 "sensors" : {
7777 "temperature" : 16.5 ,
182182 "zigbee_mac_address" : " 000D6F000C8FF5EE" ,
183183 "vendor" : " Plugwise" ,
184184 "binary_sensors" : {
185- "battery_state " : false
185+ "low_battery " : false
186186 },
187187 "sensors" : {
188188 "temperature" : 17.6 ,
Original file line number Diff line number Diff line change 2828 },
2929 "e2f4322d57924fa090fbbc48b3a140dc" : {
3030 "binary_sensors" : {
31- "battery_state " : false
31+ "low_battery " : false
3232 },
3333 "mode" : " off"
3434 },
You can’t perform that action at this time.
0 commit comments