Skip to content

Commit 3784798

Browse files
committed
Perform a single find-action
1 parent 50a2f3c commit 3784798

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

plugwise/helper.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -968,11 +968,9 @@ def _control_state(self, data: GwEntityData, loc_id: str) -> str | bool:
968968
Represents the heating/cooling demand-state of the local primary thermostat.
969969
Note: heating or cooling can still be active when the setpoint has been reached.
970970
"""
971-
locator = f'location[@id="{loc_id}"]'
972-
if (location := self._domain_objects.find(locator)) is not None:
973-
locator = './actuator_functionalities/thermostat_functionality[type="thermostat"]/control_state'
974-
if (ctrl_state := location.find(locator)) is not None:
975-
return str(ctrl_state.text)
971+
locator = f'location[@id="{loc_id}"]/actuator_functionalities/thermostat_functionality[type="thermostat"]/control_state'
972+
if (ctrl_state := self._domain_objects.find(locator)) is not None:
973+
return str(ctrl_state.text)
976974

977975
# Handle missing control_state in regulation_mode off for firmware >= 3.2.0 (issue #776)
978976
# In newer firmware versions, default to "off" when control_state is not present

0 commit comments

Comments
 (0)