Skip to content

Commit f473609

Browse files
committed
Fix code, ongoing 2
1 parent 444a675 commit f473609

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

plugwise/helper.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,10 @@ def _control_state(self, data: GwEntityData, loc_id: str) -> str | bool:
783783
if (ctrl_state := self._domain_objects.find(locator)) is not None:
784784
return str(ctrl_state.text)
785785

786-
# Handle missing control_state in regulation_mode off for firmware >= 3.2.0 (issue #776)
786+
# Adam: handle missing control_state in regulation_mode off for firmware >= 3.2.0 (issue #776)
787+
# TODO issue also present for Anna? Check!
787788
# In newer firmware versions, default to "off" when control_state is not present
788-
if self.smile.version != version.Version("0.0.0"):
789+
if self.check_name(ADAM) and self.smile.version != version.Version("0.0.0"):
789790
if self.smile.version >= version.parse("3.2.0"):
790791
return "off"
791792

@@ -794,7 +795,15 @@ def _control_state(self, data: GwEntityData, loc_id: str) -> str | bool:
794795
setpoint = data["sensors"]["setpoint"]
795796
temperature = data["sensors"]["temperature"]
796797
# No cooling available in older firmware
797-
return "heating" if temperature < setpoint else "off"
798+
return "heating" if temperature < setpoint else "idle"
799+
800+
if self.check_name(ANNA):
801+
# Older Anna firmware does not have the control_state xml-key
802+
# Work around this by comparing the reported temperature and setpoint for a location
803+
setpoint = data["sensors"]["setpoint"]
804+
temperature = data["sensors"]["temperature"]
805+
# No cooling available in older firmware
806+
return "heating" if temperature < setpoint else "idle"
798807

799808
return False # pragma: no cover
800809

0 commit comments

Comments
 (0)