From c2e4ffdad67dd4ad49bc22734394c883b86d730f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Mon, 24 Nov 2025 20:03:02 +0100 Subject: [PATCH 01/40] Improve support for groups --- plugwise/common.py | 17 +++++++++-------- plugwise/constants.py | 2 ++ plugwise/legacy/smile.py | 2 +- plugwise/smile.py | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/plugwise/common.py b/plugwise/common.py index 47a456266..9beaa1ee9 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -9,6 +9,7 @@ from plugwise.constants import ( ANNA, + GROUP_TYPES, NONE, PRIORITY_DEVICE_CLASSES, SPECIAL_PLUG_TYPES, @@ -187,15 +188,15 @@ def _entity_switching_group(self, entity: GwEntityData, data: GwEntityData) -> N data["switches"]["relay"] = counter != 0 self._count += 1 - def _get_group_switches(self) -> dict[str, GwEntityData]: + def _get_groups(self) -> dict[str, GwEntityData]: """Helper-function for smile.py: get_all_gateway_entities(). Collect switching- or pump-group info. """ - switch_groups: dict[str, GwEntityData] = {} - # P1 and Anna don't have switchgroups + groups: dict[str, GwEntityData] = {} + # P1 and Anna don't have groups if self.smile.type == "power" or self.check_name(ANNA): - return switch_groups + return groups for group in self._domain_objects.findall("./group"): members: list[str] = [] @@ -208,17 +209,17 @@ def _get_group_switches(self) -> dict[str, GwEntityData]: if item.attrib["id"] in self.gw_entities: members.append(item.attrib["id"]) - if group_type in SWITCH_GROUP_TYPES and members: - switch_groups[group_id] = { + if group_type in GROUP_TYPES and members: + groups[group_id] = { "dev_class": group_type, - "model": "Switchgroup", + "model": "Group", "name": group_name, "members": members, "vendor": "Plugwise", } self._count += 5 - return switch_groups + return groups def _get_lock_state( self, xml: etree.Element, data: GwEntityData, stretch_v2: bool = False diff --git a/plugwise/constants.py b/plugwise/constants.py index d68842d5f..f8d0f790f 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -299,6 +299,8 @@ ] BINARY_SENSORS: Final[tuple[str, ...]] = get_args(BinarySensorType) +GROUP_TYPES: Final[tuple[str, ...]] = ("pumping", "report", "switching") + SensorType = Literal[ "battery", "cooling_activation_outdoor_temperature", diff --git a/plugwise/legacy/smile.py b/plugwise/legacy/smile.py index 61f219521..54a21c15d 100644 --- a/plugwise/legacy/smile.py +++ b/plugwise/legacy/smile.py @@ -82,7 +82,7 @@ def get_all_gateway_entities(self) -> None: Finally, collect the data and states for each entity. """ self._all_appliances() - if group_data := self._get_group_switches(): + if group_data := self._get_groups(): self.gw_entities.update(group_data) self._all_entity_data() diff --git a/plugwise/smile.py b/plugwise/smile.py index ad6a93544..22010af5c 100644 --- a/plugwise/smile.py +++ b/plugwise/smile.py @@ -115,7 +115,7 @@ def get_all_gateway_entities(self) -> None: if self.check_name(ADAM): self._scan_thermostats() - if group_data := self._get_group_switches(): + if group_data := self._get_groups(): self.gw_entities.update(group_data) self._all_entity_data() From 834084c87a86307079bb5fa0944c7a5eb30174b1 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Mon, 24 Nov 2025 20:06:31 +0100 Subject: [PATCH 02/40] Update test-json --- tests/data/adam/adam_plus_anna_new.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/data/adam/adam_plus_anna_new.json b/tests/data/adam/adam_plus_anna_new.json index ee4ecd743..2be3d0eec 100644 --- a/tests/data/adam/adam_plus_anna_new.json +++ b/tests/data/adam/adam_plus_anna_new.json @@ -181,6 +181,16 @@ }, "vendor": "Plugwise" }, + "c9293d1d68ee48fc8843c6f0dee2b6be": { + "dev_class": "pumping", + "members": [ + "854f8a9b0e7e425db97f1f110e1ce4b3", + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "model": "Group", + "name": "Vloerverwarming", + "vendor": "Plugwise" + }, "da224107914542988a88561b4452b0f6": { "binary_sensors": { "plugwise_notification": false @@ -257,7 +267,7 @@ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", "switches": { "relay": true From 9de4460dadb08507f2b1c86f25330979483a84c0 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Mon, 24 Nov 2025 20:07:27 +0100 Subject: [PATCH 03/40] Update test asserts --- tests/test_adam.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index c45f5a354..a975862ff 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -34,7 +34,7 @@ async def test_connect_adam_plus_anna_new(self): test_items = await self.device_test(api, "2025-10-12 00:00:01", testdata) assert api.gateway_id == "da224107914542988a88561b4452b0f6" - assert self.entity_items == 220 + assert self.entity_items == 225 assert test_items == self.entity_items assert self.entity_list == [ "da224107914542988a88561b4452b0f6", @@ -49,6 +49,7 @@ async def test_connect_adam_plus_anna_new(self): "ad4838d7d35c4d6ea796ee12ae5aedf8", "14df5c4dc8cb4ba69f9d1ac0eaf7c5c6", "da575e9e09b947e281fb6e3ebce3b174", + "c9293d1d68ee48fc8843c6f0dee2b6be", "e8ef2a01ed3b4139a53bf749204fe6b4", "f2bf9048bef64cc5b6d5110154e33c81", "f871b8c4d63549319221e294e4f88074", From f29471658ab97338b95179219fdcd47123b5d37a Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Mon, 24 Nov 2025 20:19:11 +0100 Subject: [PATCH 04/40] Update test-json 2 --- .../data/adam/adam_plus_anna_new_regulation_off.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/data/adam/adam_plus_anna_new_regulation_off.json b/tests/data/adam/adam_plus_anna_new_regulation_off.json index 8d07fdc92..10cd1add3 100644 --- a/tests/data/adam/adam_plus_anna_new_regulation_off.json +++ b/tests/data/adam/adam_plus_anna_new_regulation_off.json @@ -178,6 +178,16 @@ "vendor": "Plugwise", "zigbee_mac_address": "000D6F000D5A168D" }, + "c9293d1d68ee48fc8843c6f0dee2b6be": { + "dev_class": "pumping", + "members": [ + "854f8a9b0e7e425db97f1f110e1ce4b3", + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "model": "Group", + "name": "Vloerverwarming", + "vendor": "Plugwise" + }, "e2f4322d57924fa090fbbc48b3a140dc": { "available": true, "binary_sensors": { @@ -210,7 +220,7 @@ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", "switches": { "relay": true From 24af1d9f33721ebe7f4687a088228366b27ab4b4 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 25 Nov 2025 08:20:52 +0100 Subject: [PATCH 05/40] Collect group sensors --- plugwise/common.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugwise/common.py b/plugwise/common.py index 9beaa1ee9..c64338cd6 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -21,6 +21,7 @@ from plugwise.util import ( check_heater_central, check_model, + format_measure, get_vendor_name, return_valid, ) @@ -209,12 +210,22 @@ def _get_groups(self) -> dict[str, GwEntityData]: if item.attrib["id"] in self.gw_entities: members.append(item.attrib["id"]) + group_sensors = {} + group_logs = group.findall("logs") + for log in group_logs: + log_type = log.find("type").text + measurement = log.find("period/measurement") + if measurement is not None: + group_sensors[log_type] = format_measure(measurement) + self._count += 1 + if group_type in GROUP_TYPES and members: groups[group_id] = { "dev_class": group_type, "model": "Group", "name": group_name, "members": members, + "sensors": group_sensors, "vendor": "Plugwise", } self._count += 5 From 51ced4111e8e9783554f8000d0cb1ed731738778 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 25 Nov 2025 08:26:00 +0100 Subject: [PATCH 06/40] Debug log --- plugwise/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugwise/common.py b/plugwise/common.py index c64338cd6..434a18e3b 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -10,6 +10,7 @@ from plugwise.constants import ( ANNA, GROUP_TYPES, + LOGGER, NONE, PRIORITY_DEVICE_CLASSES, SPECIAL_PLUG_TYPES, @@ -213,6 +214,7 @@ def _get_groups(self) -> dict[str, GwEntityData]: group_sensors = {} group_logs = group.findall("logs") for log in group_logs: + LOGGER.debug("HOI log: %s", etree.tostring(log)) log_type = log.find("type").text measurement = log.find("period/measurement") if measurement is not None: From a441b8c26656507b8ab9da3c22e45081852a6828 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 25 Nov 2025 08:28:42 +0100 Subject: [PATCH 07/40] Improve find --- plugwise/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise/common.py b/plugwise/common.py index 434a18e3b..ac818d1fe 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -212,7 +212,7 @@ def _get_groups(self) -> dict[str, GwEntityData]: members.append(item.attrib["id"]) group_sensors = {} - group_logs = group.findall("logs") + group_logs = group.findall("logs/point_log") for log in group_logs: LOGGER.debug("HOI log: %s", etree.tostring(log)) log_type = log.find("type").text From 0645a21f8cdb889f785d0fa5b9b37e67fda356aa Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 25 Nov 2025 19:44:57 +0100 Subject: [PATCH 08/40] Add GROUP_MEASUREMENTS constant --- plugwise/constants.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugwise/constants.py b/plugwise/constants.py index f8d0f790f..1ddd37c5f 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -106,6 +106,11 @@ UOM = namedtuple("UOM", "unit_of_measurement") DATA = namedtuple("DATA", "name unit_of_measurement") +GROUP_MEASUREMENTS: Final[dict[str, UOM]] = { + "electricity_consumed": UOM(POWER_WATT), + "electricity_produced": UOM(POWER_WATT), + "temperature": UOM(TEMP_CELSIUS), +} # P1 related measurements: P1_MEASUREMENTS: Final[dict[str, UOM]] = { "electricity_consumed": UOM(POWER_WATT), From 0d93f014e44933db0186563b237a233f81d45c7d Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 25 Nov 2025 19:52:21 +0100 Subject: [PATCH 09/40] Try --- plugwise/common.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/plugwise/common.py b/plugwise/common.py index ac818d1fe..43916c39c 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -9,6 +9,7 @@ from plugwise.constants import ( ANNA, + GROUP_MEASUREMENTS, GROUP_TYPES, LOGGER, NONE, @@ -22,6 +23,7 @@ from plugwise.util import ( check_heater_central, check_model, + common_match_cases, format_measure, get_vendor_name, return_valid, @@ -201,6 +203,7 @@ def _get_groups(self) -> dict[str, GwEntityData]: return groups for group in self._domain_objects.findall("./group"): + group_sensors = {} members: list[str] = [] group_id = group.attrib["id"] group_name = group.find("name").text @@ -211,16 +214,6 @@ def _get_groups(self) -> dict[str, GwEntityData]: if item.attrib["id"] in self.gw_entities: members.append(item.attrib["id"]) - group_sensors = {} - group_logs = group.findall("logs/point_log") - for log in group_logs: - LOGGER.debug("HOI log: %s", etree.tostring(log)) - log_type = log.find("type").text - measurement = log.find("period/measurement") - if measurement is not None: - group_sensors[log_type] = format_measure(measurement) - self._count += 1 - if group_type in GROUP_TYPES and members: groups[group_id] = { "dev_class": group_type, @@ -232,6 +225,11 @@ def _get_groups(self) -> dict[str, GwEntityData]: } self._count += 5 + for measurement, attrs in GROUP_MEASUREMENTS.items(): + locator = f'logs/point_log[type="{measurement}"]/period/measurement' + if (group_meas_loc := group.find(locator)) is not None: + common_match_cases(measurement, attrs, group_meas_loc, groups[group_id]) + return groups def _get_lock_state( From 2cffa0983c9d39957a29f17185a05d6eac94425f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 25 Nov 2025 20:13:54 +0100 Subject: [PATCH 10/40] Debug 2 --- plugwise/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugwise/common.py b/plugwise/common.py index 43916c39c..457a6cd41 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -230,6 +230,8 @@ def _get_groups(self) -> dict[str, GwEntityData]: if (group_meas_loc := group.find(locator)) is not None: common_match_cases(measurement, attrs, group_meas_loc, groups[group_id]) + LOGGER.debug("HOI groups-id: %s", groups[group_id]) + return groups def _get_lock_state( From 1487964e0a9158a61c6e6283ac2c28004dad34a9 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 25 Nov 2025 20:17:11 +0100 Subject: [PATCH 11/40] Add count, debug 3 --- plugwise/common.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugwise/common.py b/plugwise/common.py index 457a6cd41..f71a02f61 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -229,9 +229,10 @@ def _get_groups(self) -> dict[str, GwEntityData]: locator = f'logs/point_log[type="{measurement}"]/period/measurement' if (group_meas_loc := group.find(locator)) is not None: common_match_cases(measurement, attrs, group_meas_loc, groups[group_id]) + self._count += 1 - LOGGER.debug("HOI groups-id: %s", groups[group_id]) + LOGGER.debug("HOI groups: %s", groups) return groups def _get_lock_state( From 7ce779a92d32cc133625bbe7f926a7f54453b5b9 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 08:29:42 +0100 Subject: [PATCH 12/40] Reorder, add debug 4 --- plugwise/helper.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 4f1de9258..2996880ea 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -326,8 +326,10 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: Collect the appliance-data based on entity_id. """ data: GwEntityData = {"binary_sensors": {}, "sensors": {}, "switches": {}} - # Get P1 smartmeter data from LOCATIONS entity = self.gw_entities[entity_id] + LOGGER.debug("HOI entity: %s", entity) + + # Get P1 smartmeter data from LOCATIONS smile_is_power = self.smile.type == "power" if (smile_is_power or self.smile.anna_p1) and entity.get( "dev_class" From fb23596221c87c8e5cffb7d7fceb50d4cee00705 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 08:39:28 +0100 Subject: [PATCH 13/40] Add _collect_group_sensors() function --- plugwise/common.py | 9 --------- plugwise/helper.py | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/plugwise/common.py b/plugwise/common.py index f71a02f61..f84b1c0cd 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -220,19 +220,10 @@ def _get_groups(self) -> dict[str, GwEntityData]: "model": "Group", "name": group_name, "members": members, - "sensors": group_sensors, "vendor": "Plugwise", } self._count += 5 - for measurement, attrs in GROUP_MEASUREMENTS.items(): - locator = f'logs/point_log[type="{measurement}"]/period/measurement' - if (group_meas_loc := group.find(locator)) is not None: - common_match_cases(measurement, attrs, group_meas_loc, groups[group_id]) - self._count += 1 - - - LOGGER.debug("HOI groups: %s", groups) return groups def _get_lock_state( diff --git a/plugwise/helper.py b/plugwise/helper.py index 2996880ea..ed9431a39 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -21,6 +21,7 @@ DHW_SETPOINT, DOMAIN_OBJECTS, ENERGY_WATT_HOUR, + GROUP_MEASUREMENTS, HEATER_CENTRAL_MEASUREMENTS, LOCATIONS, LOGGER, @@ -339,6 +340,11 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: if smile_is_power and not self.smile.anna_p1: return data + # Get group data + measurements = GROUP_MEASUREMENTS + if "members" in entity: + self._collect_group_sensors(data, entity, entity_id, measurements) + # Get non-P1 data from APPLIANCES measurements = DEVICE_MEASUREMENTS if self._is_thermostat and entity_id == self.heater_id: @@ -370,6 +376,27 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: return data + def _collect_group_sensors( + self, + data: GwEntityData, + entity: GwEntityData, + entity_id: str, + measurements: dict[str, DATA | UOM], + ) -> None: + """Collect group sensors.""" + if ( + group := self._domain_objects.find(f'./group[@id="{entity_id}"]') + ) is None: + return None + + for measurement, attrs in measurements.items(): + locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' + if (group_meas_loc := group.find(locator)) is None: + return + + common_match_cases(measurement, attrs, group_meas_loc, data) + self._count += 1 + def _collect_appliance_data( self, data: GwEntityData, From 405502003c600abfdf923e879d64e05d23fd55a4 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 10:30:58 +0100 Subject: [PATCH 14/40] Update test-json --- tests/data/adam/adam_plus_anna_new.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/data/adam/adam_plus_anna_new.json b/tests/data/adam/adam_plus_anna_new.json index 2be3d0eec..d5d66e1e9 100644 --- a/tests/data/adam/adam_plus_anna_new.json +++ b/tests/data/adam/adam_plus_anna_new.json @@ -189,6 +189,11 @@ ], "model": "Group", "name": "Vloerverwarming", + "sensors": { + "electricity_consumed": 45.0, + "electricity_produced": 0.0, + "temperature": 20.1 + }, "vendor": "Plugwise" }, "da224107914542988a88561b4452b0f6": { From c31e58ec0051cf110c3de0f27787434f300a3b3c Mon Sep 17 00:00:00 2001 From: autoruff Date: Wed, 26 Nov 2025 09:31:34 +0000 Subject: [PATCH 15/40] fixup: improve_group Python code fixed using ruff --- plugwise/helper.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index ed9431a39..a2528a8da 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -384,13 +384,11 @@ def _collect_group_sensors( measurements: dict[str, DATA | UOM], ) -> None: """Collect group sensors.""" - if ( - group := self._domain_objects.find(f'./group[@id="{entity_id}"]') - ) is None: + if (group := self._domain_objects.find(f'./group[@id="{entity_id}"]')) is None: return None for measurement, attrs in measurements.items(): - locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' + locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' if (group_meas_loc := group.find(locator)) is None: return From 3a3bdecb18eb75c9caa149d13721128bee9f23d9 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 10:41:10 +0100 Subject: [PATCH 16/40] Cleanup, improve docstring --- plugwise/common.py | 7 +------ plugwise/helper.py | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/plugwise/common.py b/plugwise/common.py index f84b1c0cd..9722975e6 100644 --- a/plugwise/common.py +++ b/plugwise/common.py @@ -9,9 +9,7 @@ from plugwise.constants import ( ANNA, - GROUP_MEASUREMENTS, GROUP_TYPES, - LOGGER, NONE, PRIORITY_DEVICE_CLASSES, SPECIAL_PLUG_TYPES, @@ -23,8 +21,6 @@ from plugwise.util import ( check_heater_central, check_model, - common_match_cases, - format_measure, get_vendor_name, return_valid, ) @@ -195,7 +191,7 @@ def _entity_switching_group(self, entity: GwEntityData, data: GwEntityData) -> N def _get_groups(self) -> dict[str, GwEntityData]: """Helper-function for smile.py: get_all_gateway_entities(). - Collect switching- or pump-group info. + Collect switching-, pumping- or report-group info. """ groups: dict[str, GwEntityData] = {} # P1 and Anna don't have groups @@ -203,7 +199,6 @@ def _get_groups(self) -> dict[str, GwEntityData]: return groups for group in self._domain_objects.findall("./group"): - group_sensors = {} members: list[str] = [] group_id = group.attrib["id"] group_name = group.find("name").text diff --git a/plugwise/helper.py b/plugwise/helper.py index a2528a8da..027d16a19 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -328,7 +328,6 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: """ data: GwEntityData = {"binary_sensors": {}, "sensors": {}, "switches": {}} entity = self.gw_entities[entity_id] - LOGGER.debug("HOI entity: %s", entity) # Get P1 smartmeter data from LOCATIONS smile_is_power = self.smile.type == "power" @@ -385,7 +384,7 @@ def _collect_group_sensors( ) -> None: """Collect group sensors.""" if (group := self._domain_objects.find(f'./group[@id="{entity_id}"]')) is None: - return None + return for measurement, attrs in measurements.items(): locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' From 33b9b4ec8fc01b3df33d1cb200afe5052cd90881 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:13:29 +0100 Subject: [PATCH 17/40] Update test-json --- tests/data/adam/adam_plus_anna_new.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/data/adam/adam_plus_anna_new.json b/tests/data/adam/adam_plus_anna_new.json index d5d66e1e9..afa38abd8 100644 --- a/tests/data/adam/adam_plus_anna_new.json +++ b/tests/data/adam/adam_plus_anna_new.json @@ -274,6 +274,10 @@ ], "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 16.5, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, From 4c59065223e9c4dec21200377f9dc25783203c02 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:14:13 +0100 Subject: [PATCH 18/40] Update entity_items assert --- tests/test_adam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index a975862ff..4cbf2a871 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -34,7 +34,7 @@ async def test_connect_adam_plus_anna_new(self): test_items = await self.device_test(api, "2025-10-12 00:00:01", testdata) assert api.gateway_id == "da224107914542988a88561b4452b0f6" - assert self.entity_items == 225 + assert self.entity_items == 230 assert test_items == self.entity_items assert self.entity_list == [ "da224107914542988a88561b4452b0f6", From d359a35a3313c16f8c39c224adc92df7888aacb4 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:17:02 +0100 Subject: [PATCH 19/40] Update test-json 2 --- tests/data/adam/adam_zone_per_device.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/data/adam/adam_zone_per_device.json b/tests/data/adam/adam_zone_per_device.json index 31b8b4456..34fb1f46d 100644 --- a/tests/data/adam/adam_zone_per_device.json +++ b/tests/data/adam/adam_zone_per_device.json @@ -509,6 +509,19 @@ "vendor": "Plugwise", "zigbee_mac_address": "ABCD012345670A06" }, + "e117db6848394c8cb70d9c28e63d92d2": { + "dev_class": "pumping", + "members": [ + "78d1126fc4c743db81b61c20e88342a7", + "b59bcebaf94b499ea7d46e4a66fb62d8" + ], + "model": "Group", + "name": "Vloerverwarming Woonkamer", + "sensors": { + "electricity_consumed": 35.8 + }, + "vendor": "Plugwise" + }, "e7693eb9582644e5b865dba8d4447cf1": { "available": true, "binary_sensors": { From 6f2efcfa7c1dbdda695f4c01ccb8b980459436d9 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:17:58 +0100 Subject: [PATCH 20/40] Update entity_items 2 --- tests/test_adam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index 4cbf2a871..6639350f7 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -228,7 +228,7 @@ async def test_connect_adam_zone_per_device(self): test_items = await self.device_test(api, "2022-05-16 00:00:01", testdata) assert api.gateway_id == "fe799307f1624099878210aa0b9f1475" - assert self.entity_items == 379 + assert self.entity_items == 385 assert test_items == self.entity_items assert "af82e4ccf9c548528166d38e560662a4" in self.notifications From 3e69b8a1f5f835bd9c95a3c1017806c995245571 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:20:32 +0100 Subject: [PATCH 21/40] Update test-json 3 --- .../adam/adam_multiple_devices_per_zone.json | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/data/adam/adam_multiple_devices_per_zone.json b/tests/data/adam/adam_multiple_devices_per_zone.json index ab49c5a65..4a9140468 100644 --- a/tests/data/adam/adam_multiple_devices_per_zone.json +++ b/tests/data/adam/adam_multiple_devices_per_zone.json @@ -512,6 +512,19 @@ "vendor": "Plugwise", "zigbee_mac_address": "ABCD012345670A06" }, + "e117db6848394c8cb70d9c28e63d92d2": { + "dev_class": "pumping", + "members": [ + "78d1126fc4c743db81b61c20e88342a7", + "b59bcebaf94b499ea7d46e4a66fb62d8" + ], + "model": "Group", + "name": "Vloerverwarming Woonkamer", + "sensors": { + "electricity_consumed": 35.6 + }, + "vendor": "Plugwise" + }, "e7693eb9582644e5b865dba8d4447cf1": { "available": true, "binary_sensors": { @@ -546,8 +559,12 @@ "02cf28bfec924855854c544690a609ef", "4a810418d5394b3f82727340b91ba740" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 14.8, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, From 4f50c899ccbed81bb0b865cbc9aa7b67f7b59c0f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:21:36 +0100 Subject: [PATCH 22/40] Update entity_items 3 --- tests/test_adam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index 6639350f7..5f1307095 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -302,7 +302,7 @@ async def test_connect_adam_multiple_devices_per_zone(self): ) test_items = await self.device_test(api, "2022-05-16 00:00:01", testdata) - assert self.entity_items == 385 + assert self.entity_items == 393 assert test_items == self.entity_items assert "af82e4ccf9c548528166d38e560662a4" in self.notifications From a1ff1abefd4a95a2780e6918cc155707bee6d98f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:23:06 +0100 Subject: [PATCH 23/40] Save test-jsons 4 --- tests/data/stretch/stretch_v23.json | 2 +- tests/data/stretch/stretch_v31.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/data/stretch/stretch_v23.json b/tests/data/stretch/stretch_v23.json index 0516e1436..5ca04fcd8 100644 --- a/tests/data/stretch/stretch_v23.json +++ b/tests/data/stretch/stretch_v23.json @@ -305,7 +305,7 @@ "f7b145c8492f4dd7a4de760456fdef3e": { "dev_class": "switching", "members": ["407aa1c1099d463c9137a3a9eda787fd"], - "model": "Switchgroup", + "model": "Group", "name": "Test", "switches": { "relay": false diff --git a/tests/data/stretch/stretch_v31.json b/tests/data/stretch/stretch_v31.json index 250839d08..9927b5c13 100644 --- a/tests/data/stretch/stretch_v31.json +++ b/tests/data/stretch/stretch_v31.json @@ -91,7 +91,7 @@ "059e4d03c7a34d278add5c7a4a781d19", "cfe95cf3de1948c0b8955125bf754614" ], - "model": "Switchgroup", + "model": "Group", "name": "Schakel", "switches": { "relay": true @@ -107,7 +107,7 @@ "cfe95cf3de1948c0b8955125bf754614", "e1c884e7dede431dadee09506ec4f859" ], - "model": "Switchgroup", + "model": "Group", "name": "Stroomvreters", "switches": { "relay": true From 6dd37ae0b671a98adca7d1bfc461182ab2288987 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:25:23 +0100 Subject: [PATCH 24/40] Save updated fixtures --- .../adam_multiple_devices_per_zone/data.json | 19 ++++++++++++++++- fixtures/adam_plus_anna_new/data.json | 21 ++++++++++++++++++- .../data.json | 21 ++++++++++++++++++- fixtures/adam_zone_per_device/data.json | 13 ++++++++++++ fixtures/stretch_v23/data.json | 2 +- fixtures/stretch_v31/data.json | 4 ++-- 6 files changed, 74 insertions(+), 6 deletions(-) diff --git a/fixtures/adam_multiple_devices_per_zone/data.json b/fixtures/adam_multiple_devices_per_zone/data.json index ab49c5a65..4a9140468 100644 --- a/fixtures/adam_multiple_devices_per_zone/data.json +++ b/fixtures/adam_multiple_devices_per_zone/data.json @@ -512,6 +512,19 @@ "vendor": "Plugwise", "zigbee_mac_address": "ABCD012345670A06" }, + "e117db6848394c8cb70d9c28e63d92d2": { + "dev_class": "pumping", + "members": [ + "78d1126fc4c743db81b61c20e88342a7", + "b59bcebaf94b499ea7d46e4a66fb62d8" + ], + "model": "Group", + "name": "Vloerverwarming Woonkamer", + "sensors": { + "electricity_consumed": 35.6 + }, + "vendor": "Plugwise" + }, "e7693eb9582644e5b865dba8d4447cf1": { "available": true, "binary_sensors": { @@ -546,8 +559,12 @@ "02cf28bfec924855854c544690a609ef", "4a810418d5394b3f82727340b91ba740" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 14.8, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, diff --git a/fixtures/adam_plus_anna_new/data.json b/fixtures/adam_plus_anna_new/data.json index ee4ecd743..afa38abd8 100644 --- a/fixtures/adam_plus_anna_new/data.json +++ b/fixtures/adam_plus_anna_new/data.json @@ -181,6 +181,21 @@ }, "vendor": "Plugwise" }, + "c9293d1d68ee48fc8843c6f0dee2b6be": { + "dev_class": "pumping", + "members": [ + "854f8a9b0e7e425db97f1f110e1ce4b3", + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "model": "Group", + "name": "Vloerverwarming", + "sensors": { + "electricity_consumed": 45.0, + "electricity_produced": 0.0, + "temperature": 20.1 + }, + "vendor": "Plugwise" + }, "da224107914542988a88561b4452b0f6": { "binary_sensors": { "plugwise_notification": false @@ -257,8 +272,12 @@ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 16.5, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, diff --git a/fixtures/adam_plus_anna_new_regulation_off/data.json b/fixtures/adam_plus_anna_new_regulation_off/data.json index 8d07fdc92..0a859e23a 100644 --- a/fixtures/adam_plus_anna_new_regulation_off/data.json +++ b/fixtures/adam_plus_anna_new_regulation_off/data.json @@ -155,6 +155,21 @@ }, "vendor": "Plugwise" }, + "c9293d1d68ee48fc8843c6f0dee2b6be": { + "dev_class": "pumping", + "members": [ + "854f8a9b0e7e425db97f1f110e1ce4b3", + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "model": "Group", + "name": "Vloerverwarming", + "sensors": { + "electricity_consumed": 43.8, + "electricity_produced": 0.0, + "temperature": 18.4 + }, + "vendor": "Plugwise" + }, "da224107914542988a88561b4452b0f6": { "binary_sensors": { "plugwise_notification": false @@ -210,8 +225,12 @@ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 14.8, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, diff --git a/fixtures/adam_zone_per_device/data.json b/fixtures/adam_zone_per_device/data.json index 31b8b4456..34fb1f46d 100644 --- a/fixtures/adam_zone_per_device/data.json +++ b/fixtures/adam_zone_per_device/data.json @@ -509,6 +509,19 @@ "vendor": "Plugwise", "zigbee_mac_address": "ABCD012345670A06" }, + "e117db6848394c8cb70d9c28e63d92d2": { + "dev_class": "pumping", + "members": [ + "78d1126fc4c743db81b61c20e88342a7", + "b59bcebaf94b499ea7d46e4a66fb62d8" + ], + "model": "Group", + "name": "Vloerverwarming Woonkamer", + "sensors": { + "electricity_consumed": 35.8 + }, + "vendor": "Plugwise" + }, "e7693eb9582644e5b865dba8d4447cf1": { "available": true, "binary_sensors": { diff --git a/fixtures/stretch_v23/data.json b/fixtures/stretch_v23/data.json index 0516e1436..5ca04fcd8 100644 --- a/fixtures/stretch_v23/data.json +++ b/fixtures/stretch_v23/data.json @@ -305,7 +305,7 @@ "f7b145c8492f4dd7a4de760456fdef3e": { "dev_class": "switching", "members": ["407aa1c1099d463c9137a3a9eda787fd"], - "model": "Switchgroup", + "model": "Group", "name": "Test", "switches": { "relay": false diff --git a/fixtures/stretch_v31/data.json b/fixtures/stretch_v31/data.json index 250839d08..9927b5c13 100644 --- a/fixtures/stretch_v31/data.json +++ b/fixtures/stretch_v31/data.json @@ -91,7 +91,7 @@ "059e4d03c7a34d278add5c7a4a781d19", "cfe95cf3de1948c0b8955125bf754614" ], - "model": "Switchgroup", + "model": "Group", "name": "Schakel", "switches": { "relay": true @@ -107,7 +107,7 @@ "cfe95cf3de1948c0b8955125bf754614", "e1c884e7dede431dadee09506ec4f859" ], - "model": "Switchgroup", + "model": "Group", "name": "Stroomvreters", "switches": { "relay": true From 1fc00c097baf07c87ae4d754db47a148471e9981 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:28:50 +0100 Subject: [PATCH 25/40] Typing fix --- plugwise/helper.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 027d16a19..68d90c220 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -340,9 +340,8 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: return data # Get group data - measurements = GROUP_MEASUREMENTS if "members" in entity: - self._collect_group_sensors(data, entity, entity_id, measurements) + self._collect_group_sensors(data, entity, entity_id, GROUP_MEASUREMENTS) # Get non-P1 data from APPLIANCES measurements = DEVICE_MEASUREMENTS @@ -380,7 +379,7 @@ def _collect_group_sensors( data: GwEntityData, entity: GwEntityData, entity_id: str, - measurements: dict[str, DATA | UOM], + measurements: dict[str, UOM], ) -> None: """Collect group sensors.""" if (group := self._domain_objects.find(f'./group[@id="{entity_id}"]')) is None: From 627958ceb47da8bae177fb3d678fe1ccdb44fb7d Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:34:51 +0100 Subject: [PATCH 26/40] Rework to avoid extra testcode --- plugwise/helper.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 68d90c220..13e701a26 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -382,16 +382,14 @@ def _collect_group_sensors( measurements: dict[str, UOM], ) -> None: """Collect group sensors.""" - if (group := self._domain_objects.find(f'./group[@id="{entity_id}"]')) is None: - return - - for measurement, attrs in measurements.items(): - locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' - if (group_meas_loc := group.find(locator)) is None: - return + if (group := self._domain_objects.find(f'./group[@id="{entity_id}"]')) is not None: + for measurement, attrs in measurements.items(): + locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' + if (group_meas_loc := group.find(locator)) is None: + return - common_match_cases(measurement, attrs, group_meas_loc, data) - self._count += 1 + common_match_cases(measurement, attrs, group_meas_loc, data) + self._count += 1 def _collect_appliance_data( self, From 088cde8c6d27e7cf29d5b7cdf7712b8c20518ca3 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:35:55 +0100 Subject: [PATCH 27/40] Save various updates --- fixtures/m_adam_cooling/data.json | 21 ++++++++++++++++++- fixtures/m_adam_heating/data.json | 21 ++++++++++++++++++- .../data.json | 19 ++++++++++++++++- plugwise/helper.py | 4 +++- 4 files changed, 61 insertions(+), 4 deletions(-) diff --git a/fixtures/m_adam_cooling/data.json b/fixtures/m_adam_cooling/data.json index fdd52b1ef..9b95475eb 100644 --- a/fixtures/m_adam_cooling/data.json +++ b/fixtures/m_adam_cooling/data.json @@ -91,6 +91,21 @@ }, "vendor": "Plugwise" }, + "c9293d1d68ee48fc8843c6f0dee2b6be": { + "dev_class": "pumping", + "members": [ + "854f8a9b0e7e425db97f1f110e1ce4b3", + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "model": "Group", + "name": "Vloerverwarming", + "sensors": { + "electricity_consumed": 45.0, + "electricity_produced": 0.0, + "temperature": 20.1 + }, + "vendor": "Plugwise" + }, "da224107914542988a88561b4452b0f6": { "binary_sensors": { "plugwise_notification": false @@ -173,8 +188,12 @@ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 16.5, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, diff --git a/fixtures/m_adam_heating/data.json b/fixtures/m_adam_heating/data.json index 2f3951c0c..47a8fdeb2 100644 --- a/fixtures/m_adam_heating/data.json +++ b/fixtures/m_adam_heating/data.json @@ -96,6 +96,21 @@ }, "vendor": "Plugwise" }, + "c9293d1d68ee48fc8843c6f0dee2b6be": { + "dev_class": "pumping", + "members": [ + "854f8a9b0e7e425db97f1f110e1ce4b3", + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "model": "Group", + "name": "Vloerverwarming", + "sensors": { + "electricity_consumed": 45.0, + "electricity_produced": 0.0, + "temperature": 20.1 + }, + "vendor": "Plugwise" + }, "da224107914542988a88561b4452b0f6": { "binary_sensors": { "plugwise_notification": false @@ -172,8 +187,12 @@ "2568cc4b9c1e401495d4741a5f89bee1", "29542b2b6a6a4169acecc15c72a599b8" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 16.5, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, diff --git a/fixtures/m_adam_multiple_devices_per_zone/data.json b/fixtures/m_adam_multiple_devices_per_zone/data.json index f1880ba69..1f1e9cf06 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/data.json @@ -505,6 +505,19 @@ "vendor": "Plugwise", "zigbee_mac_address": "ABCD012345670A06" }, + "e117db6848394c8cb70d9c28e63d92d2": { + "dev_class": "pumping", + "members": [ + "78d1126fc4c743db81b61c20e88342a7", + "b59bcebaf94b499ea7d46e4a66fb62d8" + ], + "model": "Group", + "name": "Vloerverwarming Woonkamer", + "sensors": { + "electricity_consumed": 35.6 + }, + "vendor": "Plugwise" + }, "e7693eb9582644e5b865dba8d4447cf1": { "available": true, "binary_sensors": { @@ -539,8 +552,12 @@ "02cf28bfec924855854c544690a609ef", "4a810418d5394b3f82727340b91ba740" ], - "model": "Switchgroup", + "model": "Group", "name": "Test", + "sensors": { + "electricity_consumed": 14.8, + "electricity_produced": 0.0 + }, "switches": { "relay": true }, diff --git a/plugwise/helper.py b/plugwise/helper.py index 13e701a26..63e2fd3d4 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -382,7 +382,9 @@ def _collect_group_sensors( measurements: dict[str, UOM], ) -> None: """Collect group sensors.""" - if (group := self._domain_objects.find(f'./group[@id="{entity_id}"]')) is not None: + if ( + group := self._domain_objects.find(f'./group[@id="{entity_id}"]') + ) is not None: for measurement, attrs in measurements.items(): locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' if (group_meas_loc := group.find(locator)) is None: From f224ad5092364723264a32b0eab67cb17ce3ed76 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:37:45 +0100 Subject: [PATCH 28/40] Add biome.json config file to solve filesize warnings --- biome.json | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 biome.json diff --git a/biome.json b/biome.json new file mode 100644 index 000000000..85183c346 --- /dev/null +++ b/biome.json @@ -0,0 +1,5 @@ +{ + "files": { + "maxSize": 5000000 + } +} \ No newline at end of file From 97626a0d6b98011a0e9a8e299fc96d54df64b021 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:41:42 +0100 Subject: [PATCH 29/40] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47d6847b7..2f97c0f90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.11.0 + +- Extend feature: support pumping group, add group sensors + ## v1.10.0 - New feature: implement setting Adam zone profile via PR [#814](https://github.com/plugwise/python-plugwise/pull/814) From 79a3835fbf2661e597f12b73e09c6bad81d53519 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:42:16 +0100 Subject: [PATCH 30/40] Bump to v1.11.0a0 for testing --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bb78312fa..21fc243ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.10.0" +version = "1.11.0a0" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" From 04c9722928b289a4ef8cec7c5f9df2cc6a8fccce Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:45:05 +0100 Subject: [PATCH 31/40] Clean up, as suggested --- plugwise/helper.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 63e2fd3d4..702317023 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -341,7 +341,7 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: # Get group data if "members" in entity: - self._collect_group_sensors(data, entity, entity_id, GROUP_MEASUREMENTS) + self._collect_group_sensors(data, entity_id, GROUP_MEASUREMENTS) # Get non-P1 data from APPLIANCES measurements = DEVICE_MEASUREMENTS @@ -377,7 +377,6 @@ def _get_measurement_data(self, entity_id: str) -> GwEntityData: def _collect_group_sensors( self, data: GwEntityData, - entity: GwEntityData, entity_id: str, measurements: dict[str, UOM], ) -> None: From 08821dbb6b918bf56fb30b50ddf49b6f5f4b638a Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:45:53 +0100 Subject: [PATCH 32/40] Fix biome.json formatting --- biome.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/biome.json b/biome.json index 85183c346..00ec4d1e9 100644 --- a/biome.json +++ b/biome.json @@ -2,4 +2,4 @@ "files": { "maxSize": 5000000 } -} \ No newline at end of file +} From 78f10a31761c77edd90e15cf52311f98d2d6fd7f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:48:04 +0100 Subject: [PATCH 33/40] Make sure to continue for-loop as suggested --- plugwise/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 702317023..475eabd32 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -387,7 +387,7 @@ def _collect_group_sensors( for measurement, attrs in measurements.items(): locator = f'.//logs/point_log[type="{measurement}"]/period/measurement' if (group_meas_loc := group.find(locator)) is None: - return + continue common_match_cases(measurement, attrs, group_meas_loc, data) self._count += 1 From 65c9bc536d473a0be40144d51db507418448c42c Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:50:15 +0100 Subject: [PATCH 34/40] Update test-json --- tests/data/adam/adam_zone_per_device.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/data/adam/adam_zone_per_device.json b/tests/data/adam/adam_zone_per_device.json index 34fb1f46d..c40afc0ba 100644 --- a/tests/data/adam/adam_zone_per_device.json +++ b/tests/data/adam/adam_zone_per_device.json @@ -518,7 +518,8 @@ "model": "Group", "name": "Vloerverwarming Woonkamer", "sensors": { - "electricity_consumed": 35.8 + "electricity_consumed": 35.8, + "temperature": 21.1 }, "vendor": "Plugwise" }, From c7656c00bb99268de52a2940d173be0ee6f80fb6 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:50:57 +0100 Subject: [PATCH 35/40] Correct entity_item assert --- tests/test_adam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index 5f1307095..41739d376 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -228,7 +228,7 @@ async def test_connect_adam_zone_per_device(self): test_items = await self.device_test(api, "2022-05-16 00:00:01", testdata) assert api.gateway_id == "fe799307f1624099878210aa0b9f1475" - assert self.entity_items == 385 + assert self.entity_items == 386 assert test_items == self.entity_items assert "af82e4ccf9c548528166d38e560662a4" in self.notifications From 79fa87d27d614d34054e9bb7c854dea0a679399f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:52:20 +0100 Subject: [PATCH 36/40] Update 2nd test-json --- tests/data/adam/adam_multiple_devices_per_zone.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/data/adam/adam_multiple_devices_per_zone.json b/tests/data/adam/adam_multiple_devices_per_zone.json index 4a9140468..364d71e59 100644 --- a/tests/data/adam/adam_multiple_devices_per_zone.json +++ b/tests/data/adam/adam_multiple_devices_per_zone.json @@ -521,7 +521,8 @@ "model": "Group", "name": "Vloerverwarming Woonkamer", "sensors": { - "electricity_consumed": 35.6 + "electricity_consumed": 35.6, + "temperature": 20.9 }, "vendor": "Plugwise" }, From 9ad26a4e4f508d14b09d3e1ed6d4e31c5701ff0e Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:53:04 +0100 Subject: [PATCH 37/40] Correct 2nd entity_items assert --- tests/test_adam.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index 41739d376..8484d56d7 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -302,7 +302,7 @@ async def test_connect_adam_multiple_devices_per_zone(self): ) test_items = await self.device_test(api, "2022-05-16 00:00:01", testdata) - assert self.entity_items == 393 + assert self.entity_items == 394 assert test_items == self.entity_items assert "af82e4ccf9c548528166d38e560662a4" in self.notifications From 65d83b391a4f7505d6002ecbf5195d1091133bb0 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:53:50 +0100 Subject: [PATCH 38/40] Save updated fixtures --- fixtures/adam_multiple_devices_per_zone/data.json | 3 ++- fixtures/adam_zone_per_device/data.json | 3 ++- fixtures/m_adam_multiple_devices_per_zone/data.json | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fixtures/adam_multiple_devices_per_zone/data.json b/fixtures/adam_multiple_devices_per_zone/data.json index 4a9140468..364d71e59 100644 --- a/fixtures/adam_multiple_devices_per_zone/data.json +++ b/fixtures/adam_multiple_devices_per_zone/data.json @@ -521,7 +521,8 @@ "model": "Group", "name": "Vloerverwarming Woonkamer", "sensors": { - "electricity_consumed": 35.6 + "electricity_consumed": 35.6, + "temperature": 20.9 }, "vendor": "Plugwise" }, diff --git a/fixtures/adam_zone_per_device/data.json b/fixtures/adam_zone_per_device/data.json index 34fb1f46d..c40afc0ba 100644 --- a/fixtures/adam_zone_per_device/data.json +++ b/fixtures/adam_zone_per_device/data.json @@ -518,7 +518,8 @@ "model": "Group", "name": "Vloerverwarming Woonkamer", "sensors": { - "electricity_consumed": 35.8 + "electricity_consumed": 35.8, + "temperature": 21.1 }, "vendor": "Plugwise" }, diff --git a/fixtures/m_adam_multiple_devices_per_zone/data.json b/fixtures/m_adam_multiple_devices_per_zone/data.json index 1f1e9cf06..126031795 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/data.json @@ -514,7 +514,8 @@ "model": "Group", "name": "Vloerverwarming Woonkamer", "sensors": { - "electricity_consumed": 35.6 + "electricity_consumed": 35.6, + "temperature": 20.9 }, "vendor": "Plugwise" }, From d60d9449d9c957d3c29effcee2d833845a02c1d1 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 17:54:15 +0100 Subject: [PATCH 39/40] Bump to a1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 21fc243ca..049b19d74 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.11.0a0" +version = "1.11.0a1" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" From dd598d255c1c3a40b2845acf414d3af7a2a21e68 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 26 Nov 2025 20:28:00 +0100 Subject: [PATCH 40/40] Set to v1.11.0 release-version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 049b19d74..e3df36e18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.11.0a1" +version = "1.11.0" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md"