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/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/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/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..f1880ba69 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 }, @@ -587,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 }, 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 diff --git a/plugwise/data.py b/plugwise/data.py index 5fafb14ff..1e84bb3b9 100644 --- a/plugwise/data.py +++ b/plugwise/data.py @@ -268,11 +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 # Set HA climate HVACMode: auto, heat, heat_cool, cool and off data["climate_mode"] = "auto" diff --git a/plugwise/helper.py b/plugwise/helper.py index 16ef1f0a3..49c96fcdd 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 + if self._dhw_allowed_modes: + data["select_dhw_mode"] = appl_p_loc.text common_match_cases(measurement, attrs, appl_p_loc, data) @@ -522,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: @@ -535,29 +536,31 @@ 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 ( mode := self._get_actuator_mode( appliance, entity_id, "regulation_mode_control_functionality" ) ) is not None: - data["select_regulation_mode"] = mode - self._count += 1 + # 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 + self._count += 1 def _get_gateway_mode( self, appliance: etree.Element, entity_id: str, data: GwEntityData ) -> None: """Helper-function for _get_measurement_data(). - Adam: collect the gateway mode. + Adam gateway: collect the gateway mode. """ if ( mode := self._get_actuator_mode( appliance, entity_id, "gateway_mode_control_functionality" ) - ) is not None: + ) is not None and self._gw_allowed_modes: data["select_gateway_mode"] = mode self._count += 1 diff --git a/plugwise/legacy/data.py b/plugwise/legacy/data.py index 03ee4a014..823bc8991 100644 --- a/plugwise/legacy/data.py +++ b/plugwise/legacy/data.py @@ -67,11 +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 # Set HA climate HVACMode: auto, heat data["climate_mode"] = "auto" diff --git a/pyproject.toml b/pyproject.toml index 435561b88..326fed51f 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.8" license = "MIT" description = "Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3." readme = "README.md" diff --git a/scripts/manual_fixtures.py b/scripts/manual_fixtures.py index aae0a2cb9..c303c7eb1 100755 --- a/scripts/manual_fixtures.py +++ b/scripts/manual_fixtures.py @@ -36,12 +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) 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_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/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 }, diff --git a/tests/test_adam.py b/tests/test_adam.py index 37e8b0f6e..da6449ac0 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 @@ -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( @@ -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)