Skip to content

Commit 6443ffb

Browse files
committed
Fix and copy to legacy
1 parent d8ebeb8 commit 6443ffb

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

plugwise/helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ def _appliance_measurements(
604604
# Count only the items in the binary_sensors, sensors and
605605
# switches dicts, and the single data items in data
606606
total_bsssw_dict_items = sum(
607-
len(data.get(key, {})) for key in ["binary_sensors", "sensors", "switches"]
607+
len(data.get(key, {})) for key in ("binary_sensors", "sensors", "switches")
608608
)
609609
self._count += total_bsssw_dict_items + len(data) - len(
610610
[k for k in data if isinstance(data[k], dict)]

plugwise/legacy/helper.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,14 @@ def _appliance_measurements(
360360
appl_i_loc.text, ENERGY_WATT_HOUR
361361
)
362362

363-
self._count += len(data["binary_sensors"])
364-
self._count += len(data["sensors"])
365-
self._count += len(data["switches"])
366-
# Don't count the above top-level dicts, only the remaining single items
367-
self._count += len(data) - 3
363+
# Count only the items in the binary_sensors, sensors and
364+
# switches dicts, and the single data items in data
365+
total_bsssw_dict_items = sum(
366+
len(data.get(key, {})) for key in ("binary_sensors", "sensors", "switches")
367+
)
368+
self._count += total_bsssw_dict_items + len(data) - len(
369+
[k for k in data if isinstance(data[k], dict)]
370+
)
368371

369372
def _get_actuator_functionalities(
370373
self,

0 commit comments

Comments
 (0)