Skip to content

Commit 9397522

Browse files
committed
Reorganize _get_entity_data()
1 parent ce46d09 commit 9397522

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

plugwise/data.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -183,30 +183,27 @@ def _get_entity_data(self, entity_id: str, entity: GwEntityData) -> None:
183183
Provide entity-data, based on appliance_id (= entity_id).
184184
"""
185185
self._get_measurement_data(entity_id, entity)
186-
187-
# Check availability of wired-connected entities
188-
# Smartmeter
189-
self._check_availability(
190-
entity, "smartmeter", "P1 does not seem to be connected"
191-
)
192-
# OpenTherm entity
193-
if entity["name"] != "OnOff":
194-
self._check_availability(
195-
entity, "heater_central", "no OpenTherm communication"
196-
)
197-
# Zigbee node availability
198-
self._update_zigbee_availability(entity)
199-
200-
# Switching groups data
201-
self._entity_switching_group(entity)
202186
# Adam data
203187
if self.check_name(ADAM):
204188
self._get_adam_data(entity)
205-
189+
# Update ZigBee node availability
190+
self._update_zigbee_availability(entity)
191+
# Update switching-group status
192+
self._entity_switching_group(entity)
206193
# Thermostat data for Anna (presets, temperatures etc)
207194
if self.check_name(ANNA) and entity["dev_class"] == "thermostat":
208195
self._climate_data(entity_id, entity)
209196
self._get_anna_control_state(entity)
197+
# Check availability of wired-connected entities,
198+
# Smartmeter:
199+
self._check_availability(
200+
entity, "smartmeter", "P1 does not seem to be connected"
201+
)
202+
# OpenTherm entity:
203+
if entity["name"] != "OnOff":
204+
self._check_availability(
205+
entity, "heater_central", "no OpenTherm communication"
206+
)
210207

211208
def _check_availability(
212209
self, entity: GwEntityData, dev_class: str, message: str

0 commit comments

Comments
 (0)