Skip to content

Commit 7e54a4b

Browse files
committed
Create control_state for Anna
1 parent 3801070 commit 7e54a4b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

plugwise/data.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def _get_entity_data(self, entity_id: str) -> GwEntityData:
211211
# Thermostat data for Anna (presets, temperatures etc)
212212
if self.smile(ANNA) and entity["dev_class"] == "thermostat":
213213
self._climate_data(entity_id, entity, data)
214+
self._get_anna_control_state(data)
214215

215216
return data
216217

@@ -308,6 +309,18 @@ def check_reg_mode(self, mode: str) -> bool:
308309
"regulation_modes" in gateway and gateway["select_regulation_mode"] == mode
309310
)
310311

312+
def _get_anna_control_state(self, data: GwEntityData) -> None:
313+
"""Set the thermostat control_state based on the opentherm/onoff device state."""
314+
data["control_state"] = "idle"
315+
for entity_id in self.gw_entities:
316+
if self.gw_entities[entity_id]["dev_class"] != "heater_central":
317+
continue
318+
319+
if self.gw_entities[entity_id]["binary_sensors"]["heating_state"]:
320+
data["control_state"] = "heating"
321+
if self.gw_entities[entity_id]["binary_sensors"].get("cooling_state"):
322+
data["control_state"] = "cooling"
323+
311324
def _get_schedule_states_with_off(
312325
self, location: str, schedules: list[str], selected: str, data: GwEntityData
313326
) -> None:

0 commit comments

Comments
 (0)