File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed
Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -1544,15 +1544,12 @@ def _get_toggle_state(
15441544 Obtain the toggle state of a 'toggle' = switch.
15451545 """
15461546 if xml .find ("type" ).text == "heater_central" :
1547- locator = "./actuator_functionalities/toggle_functionality"
1548- if found := xml .findall (locator ):
1549- for item in found :
1550- if (toggle_type := item .find ("type" )) is not None :
1551- if toggle_type .text == toggle :
1552- data ["switches" ][name ] = item .find ("state" ).text == "on"
1553- self ._count += 1
1554- # Remove the cooling_enabled binary_sensor when the corresponding switch is present
1555- # Except for Elga
1556- if toggle == "cooling_enabled" and not self ._elga :
1557- data ["binary_sensors" ].pop ("cooling_enabled" )
1558- self ._count -= 1
1547+ locator = f"./actuator_functionalities/toggle_functionality[type='{ toggle } ']/state"
1548+ if (state := xml .find (locator )) is not None :
1549+ data ["switches" ][name ] = state .text == "on"
1550+ self ._count += 1
1551+ # Remove the cooling_enabled binary_sensor when the corresponding switch is present
1552+ # Except for Elga
1553+ if toggle == "cooling_enabled" and not self ._elga :
1554+ data ["binary_sensors" ].pop ("cooling_enabled" )
1555+ self ._count -= 1
You can’t perform that action at this time.
0 commit comments