Skip to content

Commit 65de9fa

Browse files
committed
Less complex
1 parent a2c05d7 commit 65de9fa

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugwise/helper.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,13 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData:
327327
data: GwEntityData = {"binary_sensors": {}, "sensors": {}, "switches": {}}
328328
# Get P1 smartmeter data from LOCATIONS
329329
entity = self.gw_entities[entity_id]
330-
# !! DON'T CHANGE below two if-lines, will break stuff !!
331-
if self.smile.type == "power" or self.smile.anna_p1:
332-
if entity["dev_class"] == "smartmeter":
333-
data.update(self._power_data_from_location())
330+
dev_class = entity.get("dev_class")
331+
smile_is_power = self.smile.type == "power"
332+
if (smile_is_power or self.smile.anna_p1) and dev_class == "smartmeter":
333+
data.update(self._power_data_from_location())
334334

335-
if not self.smile.anna_p1:
336-
return data
335+
if smile_is_power and not self.smile.anna_p1:
336+
return data
337337

338338
# Get non-P1 data from APPLIANCES
339339
measurements = DEVICE_MEASUREMENTS

0 commit comments

Comments
 (0)