Skip to content

Commit f4fc2b5

Browse files
committed
Implement control_state for legacy Anna
1 parent 11036c2 commit f4fc2b5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plugwise/legacy/data.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def _get_entity_data(self, entity_id: str) -> GwEntityData:
6464

6565
# Thermostat data (presets, temperatures etc)
6666
self._climate_data(entity, data)
67+
self._get_anna_control_state(data)
6768

6869
return data
6970

@@ -92,3 +93,15 @@ def _climate_data(self, entity: GwEntityData, data: GwEntityData) -> None:
9293
self._count += 1
9394
if sel_schedule in (NONE, OFF):
9495
data["climate_mode"] = "heat"
96+
97+
def _get_anna_control_state(self, data: GwEntityData) -> None:
98+
"""Set the thermostat control_state based on the opentherm/onoff device state."""
99+
data["control_state"] = "idle"
100+
for entity in self.gw_entities.values():
101+
if entity["dev_class"] != "heater_central":
102+
continue
103+
104+
binary_sensors = entity["binary_sensors"]
105+
if binary_sensors["heating_state"]:
106+
data["control_state"] = "heating"
107+

0 commit comments

Comments
 (0)