Skip to content

Commit 7bdafd1

Browse files
committed
Implement suggested improvements
1 parent 8f1d69b commit 7bdafd1

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugwise/data.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,14 @@ def _get_anna_control_state(self, data: GwEntityData) -> None:
313313
"""Set the thermostat control_state based on the opentherm/onoff device state."""
314314
data["control_state"] = "idle"
315315
for entity_id in self.gw_entities:
316-
if self.gw_entities[entity_id]["dev_class"] != "heater_central":
316+
entity = self.gw_entities[entity_id]
317+
if entity["dev_class"] != "heater_central":
317318
continue
318319

319-
if self.gw_entities[entity_id]["binary_sensors"]["heating_state"]:
320+
binary_sensors = entity["binary_sensors"]
321+
if binary_sensors["heating_state"]:
320322
data["control_state"] = "heating"
321-
if self.gw_entities[entity_id]["binary_sensors"].get("cooling_state"):
323+
if binary_sensors.get("cooling_state"):
322324
data["control_state"] = "cooling"
323325

324326
def _get_schedule_states_with_off(

0 commit comments

Comments
 (0)