From 376d26ef6deecd7fdf627efc1bb14cb6e4250276 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:07:27 +0200 Subject: [PATCH 01/24] Handle removal of last remaining schedule --- plugwise/data.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugwise/data.py b/plugwise/data.py index 5fafb14ff..8d2f2d7e9 100644 --- a/plugwise/data.py +++ b/plugwise/data.py @@ -273,6 +273,9 @@ def _climate_data( data["available_schedules"] = avail_schedules data["select_schedule"] = sel_schedule self._count += 2 + elif data["available_schedules"]: + data.pop("available_schedules") + data.pop("select_schedule") # Set HA climate HVACMode: auto, heat, heat_cool, cool and off data["climate_mode"] = "auto" From 1221160f08360ecd52ad96c1112f7f541f449176 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:26:39 +0200 Subject: [PATCH 02/24] Adapt to HA Select required formats --- plugwise/data.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugwise/data.py b/plugwise/data.py index 8d2f2d7e9..f45b95ff8 100644 --- a/plugwise/data.py +++ b/plugwise/data.py @@ -273,9 +273,10 @@ def _climate_data( data["available_schedules"] = avail_schedules data["select_schedule"] = sel_schedule self._count += 2 + # Handle removal of the last remaining schedule for a thermostat zone elif data["available_schedules"]: - data.pop("available_schedules") - data.pop("select_schedule") + data["available_schedules"] = [] + data["select_schedule"] = None # Set HA climate HVACMode: auto, heat, heat_cool, cool and off data["climate_mode"] = "auto" From 584c41ce1ac678957af1b26035e2617c3bd0c764 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:32:39 +0200 Subject: [PATCH 03/24] Update for legacy Anna too --- plugwise/legacy/data.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugwise/legacy/data.py b/plugwise/legacy/data.py index 03ee4a014..a3027df37 100644 --- a/plugwise/legacy/data.py +++ b/plugwise/legacy/data.py @@ -72,6 +72,10 @@ def _climate_data(self, entity: GwEntityData, data: GwEntityData) -> None: data["available_schedules"] = avail_schedules data["select_schedule"] = sel_schedule self._count += 2 + # Handle removal of the thermostat schedule + elif data["available_schedules"]: + data["available_schedules"] = [] + data["select_schedule"] = None # Set HA climate HVACMode: auto, heat data["climate_mode"] = "auto" From bd0930054c1357a0705906826ac4aabe2deb8778 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:36:47 +0200 Subject: [PATCH 04/24] Update manual_fixtures script --- scripts/manual_fixtures.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/manual_fixtures.py b/scripts/manual_fixtures.py index aae0a2cb9..c245e9b1d 100755 --- a/scripts/manual_fixtures.py +++ b/scripts/manual_fixtures.py @@ -36,11 +36,8 @@ def json_writer(manual_name: str, output: dict) -> None: adam_multiple_devices_per_zone = base.copy() # Change schedule to not present for "446ac08dd04d4eff8ac57489757b7314" -adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"].pop( - "available_schedules" -) -adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"].pop( - "select_schedule" +adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"]["available_schedules"] = [] +adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"]["select_schedule"] = None ) json_writer("m_adam_multiple_devices_per_zone", adam_multiple_devices_per_zone) From 8ffafa8a3c60835a5c20e7a4aa1705cd3e6685c4 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:40:48 +0200 Subject: [PATCH 05/24] Improve using initial values --- plugwise/data.py | 8 +++----- plugwise/legacy/data.py | 8 +++----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/plugwise/data.py b/plugwise/data.py index f45b95ff8..1e84bb3b9 100644 --- a/plugwise/data.py +++ b/plugwise/data.py @@ -268,15 +268,13 @@ def _climate_data( data["active_preset"] = self._preset(loc_id) # Schedule + data["available_schedules"] = [] + data["select_schedule"] = None + self._count += 2 avail_schedules, sel_schedule = self._schedules(loc_id) if avail_schedules != [NONE]: data["available_schedules"] = avail_schedules data["select_schedule"] = sel_schedule - self._count += 2 - # Handle removal of the last remaining schedule for a thermostat zone - elif data["available_schedules"]: - data["available_schedules"] = [] - data["select_schedule"] = None # Set HA climate HVACMode: auto, heat, heat_cool, cool and off data["climate_mode"] = "auto" diff --git a/plugwise/legacy/data.py b/plugwise/legacy/data.py index a3027df37..823bc8991 100644 --- a/plugwise/legacy/data.py +++ b/plugwise/legacy/data.py @@ -67,15 +67,13 @@ def _climate_data(self, entity: GwEntityData, data: GwEntityData) -> None: data["active_preset"] = self._preset() # Schedule + data["available_schedules"] = [] + data["select_schedule"] = None + self._count += 2 avail_schedules, sel_schedule = self._schedules() if avail_schedules != [NONE]: data["available_schedules"] = avail_schedules data["select_schedule"] = sel_schedule - self._count += 2 - # Handle removal of the thermostat schedule - elif data["available_schedules"]: - data["available_schedules"] = [] - data["select_schedule"] = None # Set HA climate HVACMode: auto, heat data["climate_mode"] = "auto" From 45a1665e4b4fc3400a61c2a326893b9c7250cadb Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:45:43 +0200 Subject: [PATCH 06/24] Update related amount of entity_items --- tests/test_adam.py | 2 +- tests/test_legacy_anna.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index 37e8b0f6e..9adc6ee5b 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -433,7 +433,7 @@ async def test_adam_plus_jip(self): assert api._last_active["06aecb3d00354375924f50c47af36bd2"] is None assert api._last_active["d27aede973b54be484f6842d1b2802ad"] is None assert api._last_active["13228dab8ce04617af318a2888b3c548"] is None - assert self.entity_items == 245 + assert self.entity_items == 253 # Negative test result = await self.tinker_thermostat( diff --git a/tests/test_legacy_anna.py b/tests/test_legacy_anna.py index a7814fd0d..dbe461d91 100644 --- a/tests/test_legacy_anna.py +++ b/tests/test_legacy_anna.py @@ -30,7 +30,7 @@ async def test_connect_legacy_anna(self): await self.device_test(api, "2020-03-22 00:00:01", testdata) assert api.gateway_id == "0000aaaa0000aaaa0000aaaa0000aa00" - assert self.entity_items == 41 + assert self.entity_items == 43 assert not api.reboot result = await self.tinker_legacy_thermostat(api, schedule_on=False) From 2dd3a3253295c1105108e7daaea57447d2ee12d7 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:49:01 +0200 Subject: [PATCH 07/24] Update typing of select_schedule --- plugwise/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise/constants.py b/plugwise/constants.py index 4710229e8..1eb657c88 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -553,7 +553,7 @@ class GwEntityData(TypedDict, total=False): preset_modes: list[str] | None # Schedules: available_schedules: list[str] - select_schedule: str + select_schedule: str | None climate_mode: str # Extra for Adam Master Thermostats From f5cdd2b915f6cad51aec61c8198bc0bac273e2ff Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:50:27 +0200 Subject: [PATCH 08/24] Scripture cleanup --- scripts/manual_fixtures.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/manual_fixtures.py b/scripts/manual_fixtures.py index c245e9b1d..c303c7eb1 100755 --- a/scripts/manual_fixtures.py +++ b/scripts/manual_fixtures.py @@ -38,7 +38,6 @@ def json_writer(manual_name: str, output: dict) -> None: # Change schedule to not present for "446ac08dd04d4eff8ac57489757b7314" adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"]["available_schedules"] = [] adam_multiple_devices_per_zone["446ac08dd04d4eff8ac57489757b7314"]["select_schedule"] = None -) json_writer("m_adam_multiple_devices_per_zone", adam_multiple_devices_per_zone) From fcd01fa1b5ba892aa403fe515a5b6e0c34edfb9c Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:51:19 +0200 Subject: [PATCH 09/24] Save updated fixtures --- fixtures/adam_jip/data.json | 8 ++++++++ fixtures/legacy_anna/data.json | 2 ++ fixtures/m_adam_jip/data.json | 8 ++++++++ fixtures/m_adam_multiple_devices_per_zone/data.json | 2 ++ 4 files changed, 20 insertions(+) diff --git a/fixtures/adam_jip/data.json b/fixtures/adam_jip/data.json index ba23d9418..d8caff4b4 100644 --- a/fixtures/adam_jip/data.json +++ b/fixtures/adam_jip/data.json @@ -1,12 +1,14 @@ { "06aecb3d00354375924f50c47af36bd2": { "active_preset": "no_frost", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 24.2 }, @@ -24,12 +26,14 @@ }, "13228dab8ce04617af318a2888b3c548": { "active_preset": "home", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 27.4 }, @@ -237,12 +241,14 @@ }, "d27aede973b54be484f6842d1b2802ad": { "active_preset": "home", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Kinderkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 30.0 }, @@ -284,12 +290,14 @@ }, "d58fec52899f4f1c92e4f8fad6d8c48c": { "active_preset": "home", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Logeerkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 30.0 }, diff --git a/fixtures/legacy_anna/data.json b/fixtures/legacy_anna/data.json index cc7e66fb1..75c12a4c8 100644 --- a/fixtures/legacy_anna/data.json +++ b/fixtures/legacy_anna/data.json @@ -35,6 +35,7 @@ }, "0d266432d64443e283b5d708ae98b455": { "active_preset": "home", + "available_schedules": [], "climate_mode": "heat", "control_state": "heating", "dev_class": "thermostat", @@ -44,6 +45,7 @@ "model": "ThermoTouch", "name": "Anna", "preset_modes": ["away", "vacation", "asleep", "home", "no_frost"], + "select_schedule": null, "sensors": { "illuminance": 150.8, "setpoint": 20.5, diff --git a/fixtures/m_adam_jip/data.json b/fixtures/m_adam_jip/data.json index 8de57910f..50b9a8109 100644 --- a/fixtures/m_adam_jip/data.json +++ b/fixtures/m_adam_jip/data.json @@ -1,11 +1,13 @@ { "06aecb3d00354375924f50c47af36bd2": { "active_preset": "no_frost", + "available_schedules": [], "climate_mode": "off", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 24.2 }, @@ -23,12 +25,14 @@ }, "13228dab8ce04617af318a2888b3c548": { "active_preset": "home", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 27.4 }, @@ -236,12 +240,14 @@ }, "d27aede973b54be484f6842d1b2802ad": { "active_preset": "home", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Kinderkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 30.0 }, @@ -283,12 +289,14 @@ }, "d58fec52899f4f1c92e4f8fad6d8c48c": { "active_preset": "home", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Logeerkamer", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 30.0 }, diff --git a/fixtures/m_adam_multiple_devices_per_zone/data.json b/fixtures/m_adam_multiple_devices_per_zone/data.json index 06459a117..6333f6491 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/data.json @@ -112,12 +112,14 @@ }, "446ac08dd04d4eff8ac57489757b7314": { "active_preset": "no_frost", + "available_schedules": [], "climate_mode": "heat", "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Garage", "preset_modes": ["home", "asleep", "away", "vacation", "no_frost"], + "select_schedule": null, "sensors": { "temperature": 15.6 }, From bb40c7710ca87f2d17e54cee93bbcc0402e471e7 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Tue, 15 Jul 2025 12:52:51 +0200 Subject: [PATCH 10/24] Update other select_* typing --- plugwise/constants.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugwise/constants.py b/plugwise/constants.py index 1eb657c88..1f76cab43 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -536,15 +536,15 @@ class GwEntityData(TypedDict, total=False): available: bool | None # Loria - select_dhw_mode: str + select_dhw_mode: str | None dhw_modes: list[str] # Gateway gateway_modes: list[str] notifications: dict[str, dict[str, str]] regulation_modes: list[str] - select_gateway_mode: str - select_regulation_mode: str + select_gateway_mode: str | None + select_regulation_mode: str | None # Thermostat-related thermostats: dict[str, list[str]] From 07b6329961ed640e5f31bf29d48ef47a77bc6454 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 08:27:34 +0200 Subject: [PATCH 11/24] Improve data["select_dhw_mode"] --- plugwise/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 16ef1f0a3..2e481dcca 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -411,7 +411,7 @@ def _appliance_measurements( case "elga_status_code": data["elga_status_code"] = int(appl_p_loc.text) case "select_dhw_mode": - data["select_dhw_mode"] = appl_p_loc.text + data["select_dhw_mode"] = appl_p_loc.text or None common_match_cases(measurement, attrs, appl_p_loc, data) From 43f8245a65c7e21efb8c4e3bc43bab863d6454ce Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:10:25 +0200 Subject: [PATCH 12/24] Improve logic for select_regulation/gateway_mode --- plugwise/helper.py | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 2e481dcca..509940c50 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -411,7 +411,8 @@ def _appliance_measurements( case "elga_status_code": data["elga_status_code"] = int(appl_p_loc.text) case "select_dhw_mode": - data["select_dhw_mode"] = appl_p_loc.text or None + if self._dhw_allowed_modes: + data["select_dhw_mode"] = appl_p_loc.text common_match_cases(measurement, attrs, appl_p_loc, data) @@ -537,11 +538,16 @@ def _get_regulation_mode( Adam: collect the gateway regulation_mode. """ - if ( - mode := self._get_actuator_mode( - appliance, entity_id, "regulation_mode_control_functionality" - ) - ) is not None: + if self._reg_allowed_modes: + if ( + mode := self._get_actuator_mode( + appliance, entity_id, "regulation_mode_control_functionality" + ) + ) is None: + data["select_regulation_mode"] = None + self._count += 1 + return + data["select_regulation_mode"] = mode self._count += 1 self._cooling_enabled = mode == "cooling" @@ -553,11 +559,16 @@ def _get_gateway_mode( Adam: collect the gateway mode. """ - if ( - mode := self._get_actuator_mode( - appliance, entity_id, "gateway_mode_control_functionality" - ) - ) is not None: + if self._gw_allowed_modes: + if ( + mode := self._get_actuator_mode( + appliance, entity_id, "gateway_mode_control_functionality" + ) + ) is None: + data["select_gateway_mode"] = None + self._count += 1 + return + data["select_gateway_mode"] = mode self._count += 1 From e0074a38d56a1a62724c571c3f7ab5a6ab2c4cac Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:19:17 +0200 Subject: [PATCH 13/24] Add extra guarding for gateway --- plugwise/helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 509940c50..2cc838584 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -523,7 +523,7 @@ def _get_actuator_mode( Collect the requested gateway mode. """ - if not (self.check_name(ADAM) and entity_id == self._gateway_id): + if not (entity_id == self._gateway_id and self.check_name(ADAM)): return None if (search := search_actuator_functionalities(appliance, key)) is not None: @@ -538,7 +538,7 @@ def _get_regulation_mode( Adam: collect the gateway regulation_mode. """ - if self._reg_allowed_modes: + if entity_id == self._gateway_id and self._reg_allowed_modes: if ( mode := self._get_actuator_mode( appliance, entity_id, "regulation_mode_control_functionality" @@ -559,7 +559,7 @@ def _get_gateway_mode( Adam: collect the gateway mode. """ - if self._gw_allowed_modes: + if entity_id == self._gateway_id and self._gw_allowed_modes: if ( mode := self._get_actuator_mode( appliance, entity_id, "gateway_mode_control_functionality" From 4e5d72bac9cd84147ab9452a1c75c2a2f4cd6ab4 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:39:11 +0200 Subject: [PATCH 14/24] Re-adapt _get_regulation_mode() --- plugwise/helper.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 2cc838584..11c642798 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -536,21 +536,17 @@ def _get_regulation_mode( ) -> None: """Helper-function for _get_measurement_data(). - Adam: collect the gateway regulation_mode. + Adam gateway: collect the gateway regulation_mode. """ - if entity_id == self._gateway_id and self._reg_allowed_modes: - if ( - mode := self._get_actuator_mode( - appliance, entity_id, "regulation_mode_control_functionality" - ) - ) is None: - data["select_regulation_mode"] = None - self._count += 1 - return - - data["select_regulation_mode"] = mode - self._count += 1 + if ( + mode := self._get_actuator_mode( + appliance, entity_id, "regulation_mode_control_functionality" + ) + ) is not None: self._cooling_enabled = mode == "cooling" + if self._reg_allowed_modes: + data["select_regulation_mode"] = mode + self._count += 1 def _get_gateway_mode( self, appliance: etree.Element, entity_id: str, data: GwEntityData From 840ff5c0ae3fb16b3c19383db01001853a65343e Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:43:13 +0200 Subject: [PATCH 15/24] Fix userdata jsons: older firmware has no regulation_mode allowed keys --- tests/data/adam/adam_multiple_devices_per_zone.json | 1 - tests/data/adam/adam_zone_per_device.json | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/data/adam/adam_multiple_devices_per_zone.json b/tests/data/adam/adam_multiple_devices_per_zone.json index 2780afe76..da11f37e6 100644 --- a/tests/data/adam/adam_multiple_devices_per_zone.json +++ b/tests/data/adam/adam_multiple_devices_per_zone.json @@ -592,7 +592,6 @@ "model": "Gateway", "model_id": "smile_open_therm", "name": "Adam", - "select_regulation_mode": "heating", "sensors": { "outdoor_temperature": 7.81 }, diff --git a/tests/data/adam/adam_zone_per_device.json b/tests/data/adam/adam_zone_per_device.json index b16d8807c..db90d8939 100644 --- a/tests/data/adam/adam_zone_per_device.json +++ b/tests/data/adam/adam_zone_per_device.json @@ -576,7 +576,6 @@ "model": "Gateway", "model_id": "smile_open_therm", "name": "Adam", - "select_regulation_mode": "heating", "sensors": { "outdoor_temperature": 7.69 }, From 3d1ce65149e31fa46804169e757c42f8f12c4b01 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:44:38 +0200 Subject: [PATCH 16/24] Update related entity_items asserts --- tests/test_adam.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_adam.py b/tests/test_adam.py index 9adc6ee5b..9f92af7a4 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -217,7 +217,7 @@ async def test_connect_adam_zone_per_device(self): assert api._last_active["82fa13f017d240daa0d0ea1775420f24"] == CV_JESSIE assert api._last_active["08963fec7c53423ca5680aa4cb502c63"] == BADKAMER_SCHEMA assert api._last_active["446ac08dd04d4eff8ac57489757b7314"] == BADKAMER_SCHEMA - assert self.entity_items == 370 + assert self.entity_items == 369 assert "af82e4ccf9c548528166d38e560662a4" in self.notifications await api.delete_notification() @@ -295,7 +295,7 @@ async def test_connect_adam_multiple_devices_per_zone(self): assert api._last_active["82fa13f017d240daa0d0ea1775420f24"] == CV_JESSIE assert api._last_active["08963fec7c53423ca5680aa4cb502c63"] == BADKAMER_SCHEMA assert api._last_active["446ac08dd04d4eff8ac57489757b7314"] == BADKAMER_SCHEMA - assert self.entity_items == 375 + assert self.entity_items == 374 assert "af82e4ccf9c548528166d38e560662a4" in self.notifications From 72e6e77cfa9d12cf2a926e9c48ad84cab94b464d Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:46:32 +0200 Subject: [PATCH 17/24] One more correction --- tests/data/adam/adam_plus_anna.json | 1 - tests/test_adam.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/data/adam/adam_plus_anna.json b/tests/data/adam/adam_plus_anna.json index bf471305e..cf02a37e4 100644 --- a/tests/data/adam/adam_plus_anna.json +++ b/tests/data/adam/adam_plus_anna.json @@ -85,7 +85,6 @@ "model": "Gateway", "model_id": "smile_open_therm", "name": "Adam", - "select_regulation_mode": "heating", "sensors": { "outdoor_temperature": 11.9 }, diff --git a/tests/test_adam.py b/tests/test_adam.py index 9f92af7a4..da6449ac0 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -389,7 +389,7 @@ async def test_connect_adam_plus_anna(self): await self.device_test(api, "2020-03-22 00:00:01", testdata) assert api.gateway_id == "b128b4bbbd1f47e9bf4d756e8fb5ee94" assert api._last_active["009490cc2f674ce6b576863fbb64f867"] == "Weekschema" - assert self.entity_items == 81 + assert self.entity_items == 80 assert "6fb89e35caeb4b1cb275184895202d84" in self.notifications result = await self.tinker_thermostat( From 37d0bd441198048d1d487c8698df1466f192abb5 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:50:08 +0200 Subject: [PATCH 18/24] Also re-adapt _get_gateway_mode() --- plugwise/helper.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 11c642798..83aefc065 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -553,20 +553,16 @@ def _get_gateway_mode( ) -> None: """Helper-function for _get_measurement_data(). - Adam: collect the gateway mode. + Adam gateway: collect the gateway mode. """ - if entity_id == self._gateway_id and self._gw_allowed_modes: - if ( - mode := self._get_actuator_mode( - appliance, entity_id, "gateway_mode_control_functionality" - ) - ) is None: - data["select_gateway_mode"] = None + if ( + mode := self._get_actuator_mode( + appliance, entity_id, "gateway_mode_control_functionality" + ) + ) is not None: + if self._gw_allowed_modes: + data["select_gateway_mode"] = mode self._count += 1 - return - - data["select_gateway_mode"] = mode - self._count += 1 def _get_gateway_outdoor_temp(self, entity_id: str, data: GwEntityData) -> None: """Adam & Anna: the Smile outdoor_temperature is present in the Home location.""" From e6e6b2793f6d49325d558a21132d8b4d3ccbf600 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:51:14 +0200 Subject: [PATCH 19/24] Save updated fixtures --- fixtures/adam_multiple_devices_per_zone/data.json | 1 - fixtures/adam_plus_anna/data.json | 1 - fixtures/adam_zone_per_device/data.json | 1 - fixtures/m_adam_multiple_devices_per_zone/data.json | 1 - 4 files changed, 4 deletions(-) diff --git a/fixtures/adam_multiple_devices_per_zone/data.json b/fixtures/adam_multiple_devices_per_zone/data.json index 8937cd465..ab49c5a65 100644 --- a/fixtures/adam_multiple_devices_per_zone/data.json +++ b/fixtures/adam_multiple_devices_per_zone/data.json @@ -596,7 +596,6 @@ "warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device." } }, - "select_regulation_mode": "heating", "sensors": { "outdoor_temperature": 7.81 }, diff --git a/fixtures/adam_plus_anna/data.json b/fixtures/adam_plus_anna/data.json index fd25947a0..8533e7468 100644 --- a/fixtures/adam_plus_anna/data.json +++ b/fixtures/adam_plus_anna/data.json @@ -89,7 +89,6 @@ "error": "There is no OpenTherm communication with the boiler." } }, - "select_regulation_mode": "heating", "sensors": { "outdoor_temperature": 11.9 }, diff --git a/fixtures/adam_zone_per_device/data.json b/fixtures/adam_zone_per_device/data.json index b53a5c357..31b8b4456 100644 --- a/fixtures/adam_zone_per_device/data.json +++ b/fixtures/adam_zone_per_device/data.json @@ -580,7 +580,6 @@ "warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device." } }, - "select_regulation_mode": "heating", "sensors": { "outdoor_temperature": 7.69 }, diff --git a/fixtures/m_adam_multiple_devices_per_zone/data.json b/fixtures/m_adam_multiple_devices_per_zone/data.json index 6333f6491..f1880ba69 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/data.json @@ -589,7 +589,6 @@ "warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device." } }, - "select_regulation_mode": "heating", "sensors": { "outdoor_temperature": 7.81 }, From 3ce925f74ceacb43942737b8755749ca91356ada Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 13:53:58 +0200 Subject: [PATCH 20/24] Revert some select_related typing updates, not required --- plugwise/constants.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugwise/constants.py b/plugwise/constants.py index 1f76cab43..1eb657c88 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -536,15 +536,15 @@ class GwEntityData(TypedDict, total=False): available: bool | None # Loria - select_dhw_mode: str | None + select_dhw_mode: str dhw_modes: list[str] # Gateway gateway_modes: list[str] notifications: dict[str, dict[str, str]] regulation_modes: list[str] - select_gateway_mode: str | None - select_regulation_mode: str | None + select_gateway_mode: str + select_regulation_mode: str # Thermostat-related thermostats: dict[str, list[str]] From 5f0d779c1135926f9be185c7daf838834cd0fbf6 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 14:04:10 +0200 Subject: [PATCH 21/24] Implement SonarQube suggestion, add explanatory comment --- plugwise/helper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 83aefc065..51d4482a4 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -543,6 +543,7 @@ def _get_regulation_mode( appliance, entity_id, "regulation_mode_control_functionality" ) ) is not None: + # Below line needs to be here to set the boolean for older Adam firmware - for testing only self._cooling_enabled = mode == "cooling" if self._reg_allowed_modes: data["select_regulation_mode"] = mode @@ -559,10 +560,9 @@ def _get_gateway_mode( mode := self._get_actuator_mode( appliance, entity_id, "gateway_mode_control_functionality" ) - ) is not None: - if self._gw_allowed_modes: - data["select_gateway_mode"] = mode - self._count += 1 + ) is not None and self._gw_allowed_modes: + data["select_gateway_mode"] = mode + self._count += 1 def _get_gateway_outdoor_temp(self, entity_id: str, data: GwEntityData) -> None: """Adam & Anna: the Smile outdoor_temperature is present in the Home location.""" From ca330d1754191a241964e0037ba9e3fb4fb19cbe Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 14:05:11 +0200 Subject: [PATCH 22/24] Bump to v1.7.8a2 test-version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 435561b88..cf5f6aa0c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.7.8a1" +version = "1.7.8a2" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" From d359f28991b9475d82d11403ee535b1de7565e91 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 15:54:18 +0200 Subject: [PATCH 23/24] Bump to v1.7.8 release-version, update CHANGELOG --- CHANGELOG.md | 5 +++-- pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 954b3fbb1..61d6b4d81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # Changelog -## Ongoing / 1.7.8a0+1 +## v1.7.8 -- Chores move module publishing on (test)pypi to Trusted Publishing (and using uv) - released as alpha 1.7.8a0+1 to demonstrate functionality +- Implement fixes related to the select-platform-data provided to the HA Core integrations, part of solving pw-beta issue [#897](https://github.com/plugwise/plugwise-beta/issues/897) +- Chores move module publishing on (test)pypi to Trusted Publishing (and using uv) ## v1.7.7 diff --git a/pyproject.toml b/pyproject.toml index cf5f6aa0c..326fed51f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.7.8a2" +version = "1.7.8" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" From a3297f37f3c928e8aec53d45ae15e18f3aac683b Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk Date: Wed, 16 Jul 2025 15:59:19 +0200 Subject: [PATCH 24/24] Improve comment --- plugwise/helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugwise/helper.py b/plugwise/helper.py index 51d4482a4..49c96fcdd 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -543,7 +543,7 @@ def _get_regulation_mode( appliance, entity_id, "regulation_mode_control_functionality" ) ) is not None: - # Below line needs to be here to set the boolean for older Adam firmware - for testing only + # Below line needs to be here to set the boolean for both older and recent Adam firmware versions self._cooling_enabled = mode == "cooling" if self._reg_allowed_modes: data["select_regulation_mode"] = mode