diff --git a/CHANGELOG.md b/CHANGELOG.md index 666501d16..c7b2af155 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## v1.6.2 + +- Improve control_state processing: + - Change value from `off` to `idle` to better match HA Core `HVACAction` states. + - Handle difference between old and new Adam firmware: set `control_state` based on `setpoint` vs `temperature` for older firmware. + - Implement fix for [#776](https://github.com/plugwise/plugwise-beta/issues/776), move it from the integration to the backend library. + - Add a test to cover the code that fixes #776. + - Update related fixtures and test-data json files. + ## v1.6.1 - Support python 3.13 diff --git a/fixtures/adam_heatpump_cooling/all_data.json b/fixtures/adam_heatpump_cooling/all_data.json index 608bbd6bb..a77bb3b14 100644 --- a/fixtures/adam_heatpump_cooling/all_data.json +++ b/fixtures/adam_heatpump_cooling/all_data.json @@ -9,7 +9,7 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer SJ", @@ -134,7 +134,7 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer DB", @@ -256,7 +256,7 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Badkamer 2", @@ -409,7 +409,7 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Badkamer 1", @@ -449,7 +449,7 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer RB", @@ -508,7 +508,7 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer SQ", @@ -568,7 +568,7 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Keuken", @@ -608,7 +608,7 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Bijkeuken", @@ -746,7 +746,7 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer JM", @@ -856,7 +856,7 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", diff --git a/fixtures/adam_jip/all_data.json b/fixtures/adam_jip/all_data.json index 2d58bb730..3943394dd 100644 --- a/fixtures/adam_jip/all_data.json +++ b/fixtures/adam_jip/all_data.json @@ -3,7 +3,7 @@ "06aecb3d00354375924f50c47af36bd2": { "active_preset": "no_frost", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer", @@ -36,7 +36,7 @@ "13228dab8ce04617af318a2888b3c548": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", @@ -267,7 +267,7 @@ "d27aede973b54be484f6842d1b2802ad": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Kinderkamer", @@ -324,7 +324,7 @@ "d58fec52899f4f1c92e4f8fad6d8c48c": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Logeerkamer", diff --git a/fixtures/adam_multiple_devices_per_zone/all_data.json b/fixtures/adam_multiple_devices_per_zone/all_data.json index fa3b9ef6c..2adf14a27 100644 --- a/fixtures/adam_multiple_devices_per_zone/all_data.json +++ b/fixtures/adam_multiple_devices_per_zone/all_data.json @@ -32,6 +32,7 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Badkamer", @@ -72,6 +73,7 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Bios", @@ -136,6 +138,7 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Garage", @@ -291,6 +294,7 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Jessie", @@ -445,6 +449,7 @@ "off" ], "climate_mode": "auto", + "control_state": "heating", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", @@ -630,7 +635,7 @@ "cooling_present": false, "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "item_count": 364, + "item_count": 369, "notifications": { "af82e4ccf9c548528166d38e560662a4": { "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." diff --git a/fixtures/adam_onoff_cooling_fake_firmware/all_data.json b/fixtures/adam_onoff_cooling_fake_firmware/all_data.json index 79e1109f8..70179277b 100644 --- a/fixtures/adam_onoff_cooling_fake_firmware/all_data.json +++ b/fixtures/adam_onoff_cooling_fake_firmware/all_data.json @@ -89,7 +89,7 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", diff --git a/fixtures/adam_plus_anna/all_data.json b/fixtures/adam_plus_anna/all_data.json index 54288e2c6..f92d7c949 100644 --- a/fixtures/adam_plus_anna/all_data.json +++ b/fixtures/adam_plus_anna/all_data.json @@ -7,6 +7,7 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Living room", @@ -138,7 +139,7 @@ "cooling_present": false, "gateway_id": "b128b4bbbd1f47e9bf4d756e8fb5ee94", "heater_id": "2743216f626f43948deec1f7ab3b3d70", - "item_count": 79, + "item_count": 80, "notifications": { "6fb89e35caeb4b1cb275184895202d84": { "error": "There is no OpenTherm communication with the boiler." diff --git a/fixtures/adam_plus_anna_new_regulation_off/all_data.json b/fixtures/adam_plus_anna_new_regulation_off/all_data.json new file mode 100644 index 000000000..f713da3e9 --- /dev/null +++ b/fixtures/adam_plus_anna_new_regulation_off/all_data.json @@ -0,0 +1,323 @@ +{ + "devices": { + "056ee145a816487eaa69243c3280f8bf": { + "available": true, + "binary_sensors": { + "dhw_state": false, + "flame_state": false, + "heating_state": false + }, + "dev_class": "heater_central", + "location": "bc93488efab249e5bc54fd7e175a6f91", + "maximum_boiler_temperature": { + "lower_bound": 25.0, + "resolution": 0.01, + "setpoint": 50.0, + "upper_bound": 95.0 + }, + "model": "Generic heater", + "name": "OpenTherm", + "sensors": { + "intended_boiler_temperature": 0.0, + "water_temperature": 30.0 + }, + "switches": { + "dhw_cm_switch": false + } + }, + "10016900610d4c7481df78c89606ef22": { + "available": true, + "dev_class": "valve_actuator_plug", + "location": "d9786723dbcf4f19b5c629a54629f9c7", + "model_id": "TS0011", + "name": "Aanvoer water afsluiter (nous lz3)", + "switches": { + "relay": false + }, + "vendor": "_TZ3000_abjodzas", + "zigbee_mac_address": "A4C13862AF9917B1" + }, + "1772a4ea304041adb83f357b751341ff": { + "available": true, + "binary_sensors": { + "low_battery": false + }, + "dev_class": "thermostatic_radiator_valve", + "firmware": "2020-11-04T01:00:00+01:00", + "hardware": "1", + "location": "f871b8c4d63549319221e294e4f88074", + "model": "Tom/Floor", + "model_id": "106-03", + "name": "Tom Badkamer", + "sensors": { + "battery": 99, + "setpoint": 18.0, + "temperature": 21.6, + "temperature_difference": -0.2, + "valve_position": 100 + }, + "temperature_offset": { + "lower_bound": -2.0, + "resolution": 0.1, + "setpoint": 0.1, + "upper_bound": 2.0 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000C8FF5EE" + }, + "2568cc4b9c1e401495d4741a5f89bee1": { + "available": true, + "dev_class": "hometheater_plug", + "firmware": "2020-11-10T01:00:00+01:00", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "Plug", + "model_id": "160-01", + "name": "Plug MediaTV", + "sensors": { + "electricity_consumed": 14.8, + "electricity_consumed_interval": 3.0, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "lock": true, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D13CCFD" + }, + "29542b2b6a6a4169acecc15c72a599b8": { + "available": true, + "dev_class": "computer_desktop_plug", + "firmware": "2020-11-10T01:00:00+01:00", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "Plug", + "model_id": "160-01", + "name": "Plug Werkplek", + "sensors": { + "electricity_consumed": 91.3, + "electricity_consumed_interval": 23.0, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "lock": false, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D13CA9A" + }, + "67d73d0bd469422db25a618a5fb8eeb0": { + "available": true, + "dev_class": "heater_central_plug", + "location": "b4f211175e124df59603412bafa77a34", + "model": "Aqara Smart Plug", + "model_id": "lumi.plug.maeu01", + "name": "SmartPlug Floor 0", + "sensors": { + "electricity_consumed_interval": 0.0 + }, + "switches": { + "lock": false, + "relay": true + }, + "vendor": "LUMI", + "zigbee_mac_address": "54EF4410002C97F2" + }, + "854f8a9b0e7e425db97f1f110e1ce4b3": { + "available": true, + "dev_class": "central_heating_pump_plug", + "firmware": "2020-11-10T01:00:00+01:00", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "Plug", + "model_id": "160-01", + "name": "Plug Vloerverwarming", + "sensors": { + "electricity_consumed": 43.8, + "electricity_consumed_interval": 0.0, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D13CB6F" + }, + "ad4838d7d35c4d6ea796ee12ae5aedf8": { + "dev_class": "thermostat", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "ThermoTouch", + "model_id": "143.1", + "name": "Anna", + "sensors": { + "setpoint": 18.5, + "temperature": 22.4 + }, + "vendor": "Plugwise" + }, + "da224107914542988a88561b4452b0f6": { + "binary_sensors": { + "plugwise_notification": false + }, + "dev_class": "gateway", + "firmware": "3.7.8", + "gateway_modes": [ + "away", + "full", + "vacation" + ], + "hardware": "AME Smile 2.0 board", + "location": "bc93488efab249e5bc54fd7e175a6f91", + "mac_address": "012345679891", + "model": "Gateway", + "model_id": "smile_open_therm", + "name": "Adam", + "regulation_modes": [ + "bleeding_hot", + "bleeding_cold", + "off", + "heating" + ], + "select_gateway_mode": "full", + "select_regulation_mode": "off", + "sensors": { + "outdoor_temperature": 9.19 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D5A168D" + }, + "e2f4322d57924fa090fbbc48b3a140dc": { + "available": true, + "binary_sensors": { + "low_battery": true + }, + "dev_class": "zone_thermostat", + "firmware": "2016-10-10T02:00:00+02:00", + "hardware": "255", + "location": "f871b8c4d63549319221e294e4f88074", + "model": "Lisa", + "model_id": "158-01", + "name": "Lisa Badkamer", + "sensors": { + "battery": 14, + "setpoint": 18.0, + "temperature": 21.5 + }, + "temperature_offset": { + "lower_bound": -2.0, + "resolution": 0.1, + "setpoint": 0.0, + "upper_bound": 2.0 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000C869B61" + }, + "e8ef2a01ed3b4139a53bf749204fe6b4": { + "dev_class": "switching", + "members": [ + "2568cc4b9c1e401495d4741a5f89bee1", + "29542b2b6a6a4169acecc15c72a599b8" + ], + "model": "Switchgroup", + "name": "Test", + "switches": { + "relay": true + }, + "vendor": "Plugwise" + }, + "f2bf9048bef64cc5b6d5110154e33c81": { + "active_preset": "home", + "available_schedules": [ + "Badkamer", + "Test", + "Vakantie", + "Weekschema", + "off" + ], + "climate_mode": "off", + "control_state": "idle", + "dev_class": "climate", + "model": "ThermoZone", + "name": "Living room", + "preset_modes": [ + "no_frost", + "asleep", + "vacation", + "home", + "away" + ], + "select_schedule": "off", + "sensors": { + "electricity_consumed": 149.9, + "electricity_produced": 0.0, + "temperature": 22.4 + }, + "thermostat": { + "lower_bound": 1.0, + "resolution": 0.01, + "setpoint": 18.5, + "upper_bound": 35.0 + }, + "thermostats": { + "primary": [ + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "secondary": [] + }, + "vendor": "Plugwise" + }, + "f871b8c4d63549319221e294e4f88074": { + "active_preset": "home", + "available_schedules": [ + "Badkamer", + "Test", + "Vakantie", + "Weekschema", + "off" + ], + "climate_mode": "off", + "control_state": "idle", + "dev_class": "climate", + "model": "ThermoZone", + "name": "Bathroom", + "preset_modes": [ + "no_frost", + "asleep", + "vacation", + "home", + "away" + ], + "select_schedule": "off", + "sensors": { + "electricity_consumed": 0.0, + "electricity_produced": 0.0, + "temperature": 21.5 + }, + "thermostat": { + "lower_bound": 0.0, + "resolution": 0.01, + "setpoint": 18.0, + "upper_bound": 99.9 + }, + "thermostats": { + "primary": [ + "e2f4322d57924fa090fbbc48b3a140dc" + ], + "secondary": [ + "1772a4ea304041adb83f357b751341ff" + ] + }, + "vendor": "Plugwise" + } + }, + "gateway": { + "cooling_present": false, + "gateway_id": "da224107914542988a88561b4452b0f6", + "heater_id": "056ee145a816487eaa69243c3280f8bf", + "item_count": 177, + "notifications": {}, + "reboot": true, + "smile_name": "Adam" + } +} diff --git a/fixtures/adam_zone_per_device/all_data.json b/fixtures/adam_zone_per_device/all_data.json index 7acb1b05b..634428a3d 100644 --- a/fixtures/adam_zone_per_device/all_data.json +++ b/fixtures/adam_zone_per_device/all_data.json @@ -32,6 +32,7 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Badkamer", @@ -73,6 +74,7 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Bios", @@ -137,6 +139,7 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Garage", @@ -292,6 +295,7 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Jessie", @@ -446,6 +450,7 @@ "off" ], "climate_mode": "auto", + "control_state": "heating", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", @@ -631,7 +636,7 @@ "cooling_present": false, "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "item_count": 364, + "item_count": 369, "notifications": { "af82e4ccf9c548528166d38e560662a4": { "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." diff --git a/fixtures/m_adam_heating/all_data.json b/fixtures/m_adam_heating/all_data.json index 7b350dddb..b1d3f9aa8 100644 --- a/fixtures/m_adam_heating/all_data.json +++ b/fixtures/m_adam_heating/all_data.json @@ -193,7 +193,7 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Bathroom", diff --git a/fixtures/m_adam_jip/all_data.json b/fixtures/m_adam_jip/all_data.json index fcc817271..c3a4c5092 100644 --- a/fixtures/m_adam_jip/all_data.json +++ b/fixtures/m_adam_jip/all_data.json @@ -3,7 +3,7 @@ "06aecb3d00354375924f50c47af36bd2": { "active_preset": "no_frost", "climate_mode": "off", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Slaapkamer", @@ -36,7 +36,7 @@ "13228dab8ce04617af318a2888b3c548": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", @@ -267,7 +267,7 @@ "d27aede973b54be484f6842d1b2802ad": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Kinderkamer", @@ -324,7 +324,7 @@ "d58fec52899f4f1c92e4f8fad6d8c48c": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Logeerkamer", diff --git a/fixtures/m_adam_multiple_devices_per_zone/all_data.json b/fixtures/m_adam_multiple_devices_per_zone/all_data.json index 522c3620e..416a2ac8e 100644 --- a/fixtures/m_adam_multiple_devices_per_zone/all_data.json +++ b/fixtures/m_adam_multiple_devices_per_zone/all_data.json @@ -32,6 +32,7 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Badkamer", @@ -72,6 +73,7 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Bios", @@ -128,6 +130,7 @@ "446ac08dd04d4eff8ac57489757b7314": { "active_preset": "no_frost", "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Garage", @@ -282,6 +285,7 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", "model": "ThermoZone", "name": "Jessie", @@ -436,6 +440,7 @@ "off" ], "climate_mode": "auto", + "control_state": "heating", "dev_class": "climate", "model": "ThermoZone", "name": "Woonkamer", @@ -621,7 +626,7 @@ "cooling_present": false, "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "item_count": 364, + "item_count": 369, "notifications": { "af82e4ccf9c548528166d38e560662a4": { "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." diff --git a/plugwise/__init__.py b/plugwise/__init__.py index 2769177cd..562ad7938 100644 --- a/plugwise/__init__.py +++ b/plugwise/__init__.py @@ -147,6 +147,7 @@ async def connect(self) -> Version | None: self.smile_model_id, self.smile_name, self.smile_type, + self.smile_version, self._port, self._username, ) if not self.smile_legacy else SmileLegacyAPI( diff --git a/plugwise/constants.py b/plugwise/constants.py index 16d3e9b29..e332f812b 100644 --- a/plugwise/constants.py +++ b/plugwise/constants.py @@ -196,6 +196,7 @@ "electricity_produced": UOM(POWER_WATT), "relay": UOM(NONE), "temperature": UOM(TEMP_CELSIUS), # HA Core thermostat current_temperature + "thermostat": DATA("setpoint", TEMP_CELSIUS), # HA Core thermostat setpoint } # Literals @@ -566,7 +567,7 @@ class GwEntityData(TypedDict, total=False): climate_mode: str # Extra for Adam Master Thermostats - control_state: str | bool + control_state: str # Dict-types binary_sensors: SmileBinarySensors diff --git a/plugwise/data.py b/plugwise/data.py index 22a86e901..3b0b58606 100644 --- a/plugwise/data.py +++ b/plugwise/data.py @@ -160,9 +160,16 @@ def _get_location_data(self, loc_id: str) -> GwEntityData: """ zone = self._zones[loc_id] data = self._get_zone_data(loc_id) - if ctrl_state := self._control_state(loc_id): - data["control_state"] = ctrl_state - self._count += 1 + if ctrl_state := self._control_state(data, loc_id): + if str(ctrl_state) in ("cooling", "heating", "preheating"): + data["control_state"] = str(ctrl_state) + self._count += 1 + if str(ctrl_state) == "off": + data["control_state"] = "idle" + self._count += 1 + + data["sensors"].pop("setpoint") # remove, only used in _control_state() + self._count -= 1 # Thermostat data (presets, temperatures etc) self._climate_data(loc_id, zone, data) diff --git a/plugwise/helper.py b/plugwise/helper.py index e9a5f5849..eae2101b7 100644 --- a/plugwise/helper.py +++ b/plugwise/helper.py @@ -64,7 +64,7 @@ from dateutil.parser import parse from defusedxml import ElementTree as etree from munch import Munch -from packaging.version import Version +from packaging import version class SmileComm: @@ -252,13 +252,14 @@ def __init__(self) -> None: self.gateway_id: str self.gw_data: GatewayData = {} self.gw_entities: dict[str, GwEntityData] = {} - self.smile_fw_version: Version | None + self.smile_fw_version: version.Version | None self.smile_hw_version: str | None self.smile_mac_address: str | None self.smile_model: str self.smile_model_id: str | None self.smile_name: str self.smile_type: str + self.smile_version: version.Version | None self.smile_zigbee_mac_address: str | None self.therms_with_offset_func: list[str] = [] self._zones: dict[str, GwEntityData] = {} @@ -917,7 +918,7 @@ def _rank_thermostat( else: thermo_loc["secondary"].append(appliance_id) - def _control_state(self, loc_id: str) -> str | bool: + def _control_state(self, data: GwEntityData, loc_id: str) -> str | bool: """Helper-function for _get_adam_data(). Adam: find the thermostat control_state of a location, from DOMAIN_OBJECTS. @@ -930,7 +931,20 @@ def _control_state(self, loc_id: str) -> str | bool: if (ctrl_state := location.find(locator)) is not None: return str(ctrl_state.text) - return False + # Handle missing control_state in regulation_mode off for firmware >= 3.2.0 (issue #776) + # In newer firmware versions, default to "off" when control_state is not present + if self.smile_version is not None: + if self.smile_version >= version.parse("3.2.0"): + return "off" + + # Older Adam firmware does not have the control_state xml-key + # Work around this by comparing the reported temperature and setpoint for a location + setpoint = data["sensors"]["setpoint"] + temperature = data["sensors"]["temperature"] + # No cooling available in older firmware + return "heating" if temperature < setpoint else "off" + + return False # pragma: no cover def _heating_valves(self) -> int | bool: """Helper-function for smile.py: _get_adam_data(). diff --git a/plugwise/smile.py b/plugwise/smile.py index eac7824ee..6a87ab585 100644 --- a/plugwise/smile.py +++ b/plugwise/smile.py @@ -66,6 +66,7 @@ def __init__( smile_model_id: str | None, smile_name: str, smile_type: str, + smile_version: Version | None, port: int = DEFAULT_PORT, username: str = DEFAULT_USERNAME, ) -> None: @@ -90,6 +91,7 @@ def __init__( self.smile_model_id = smile_model_id self.smile_name = smile_name self.smile_type = smile_type + self.smile_version = smile_version SmileData.__init__(self) diff --git a/pyproject.toml b/pyproject.toml index 6121689c1..93fb87687 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "plugwise" -version = "1.6.1" +version = "1.6.2" license = {file = "LICENSE"} 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 d806cc36d..7131a690b 100755 --- a/scripts/manual_fixtures.py +++ b/scripts/manual_fixtures.py @@ -209,7 +209,7 @@ def json_writer(manual_name: str, all_data: dict) -> None: m_adam_heating["devices"]["f871b8c4d63549319221e294e4f88074"]["climate_mode"] = "auto" m_adam_heating["devices"]["f871b8c4d63549319221e294e4f88074"][ "control_state" -] = "off" +] = "idle" # Go for da22 m_adam_heating["devices"]["da224107914542988a88561b4452b0f6"][ diff --git a/tests/data/adam/adam_heatpump_cooling.json b/tests/data/adam/adam_heatpump_cooling.json index 029cbfcd4..fe5cbcb65 100644 --- a/tests/data/adam/adam_heatpump_cooling.json +++ b/tests/data/adam/adam_heatpump_cooling.json @@ -1,5 +1,5 @@ { - "entities": { + "devices": { "04b15f6e884448288f811d29fb7b1b30": { "active_preset": "away", "available_schedules": [ @@ -9,8 +9,9 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Slaapkamer SJ", "preset_modes": [ "no_frost", @@ -36,7 +37,8 @@ "d3a276aeb3114a509bab1e4bf8c40348" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "0ca13e8176204ca7bf6f09de59f81c83": { "available": true, @@ -132,8 +134,9 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Slaapkamer DB", "preset_modes": [ "no_frost", @@ -159,7 +162,8 @@ "47e2c550a33846b680725aa3fb229473" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "2e0fc4db2a6d4cbeb7cf786143543961": { "available": true, @@ -252,8 +256,9 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Badkamer 2", "preset_modes": [ "no_frost", @@ -278,7 +283,8 @@ "f04c985c11ad4848b8fcd710343f9dcf" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "5ead63c65e5f44e7870ba2bd680ceb9e": { "available": true, @@ -403,8 +409,9 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Badkamer 1", "preset_modes": [ "no_frost", @@ -430,7 +437,8 @@ "eac5db95d97241f6b17790897847ccf5" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "93ac3f7bf25342f58cbb77c4a99ac0b3": { "active_preset": "away", @@ -441,8 +449,9 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Slaapkamer RB", "preset_modes": [ "no_frost", @@ -467,7 +476,8 @@ "c4ed311d54e341f58b4cdd201d1fde7e" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "96714ad90fc948bcbcb5021c4b9f5ae9": { "available": true, @@ -498,8 +508,9 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Slaapkamer SQ", "preset_modes": [ "no_frost", @@ -525,7 +536,8 @@ "beb32da072274e698146db8b022f3c36" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "a03b6e8e76dd4646af1a77c31dd9370c": { "available": true, @@ -556,8 +568,9 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Keuken", "preset_modes": [ "no_frost", @@ -583,7 +596,8 @@ "ea8372c0e3ad4622ad45a041d02425f5" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "b52908550469425b812c87f766fe5303": { "active_preset": "away", @@ -594,8 +608,9 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Bijkeuken", "preset_modes": [ "no_frost", @@ -621,7 +636,8 @@ "1053c8bbf8be43c6921742b146a625f1" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "bbcffa48019f4b09b8368bbaf9559e68": { "available": true, @@ -730,8 +746,9 @@ "off" ], "climate_mode": "cool", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Slaapkamer JM", "preset_modes": [ "no_frost", @@ -757,7 +774,8 @@ "7fda9f84f01342f8afe9ebbbbff30c0f" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "ea8372c0e3ad4622ad45a041d02425f5": { "available": true, @@ -838,8 +856,9 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Woonkamer", "preset_modes": [ "no_frost", @@ -865,7 +884,8 @@ "ca79d23ae0094120b877558734cff85c" ], "secondary": [] - } + }, + "vendor": "Plugwise" } } } diff --git a/tests/data/adam/adam_jip.json b/tests/data/adam/adam_jip.json index 097c530a7..1e108eec4 100644 --- a/tests/data/adam/adam_jip.json +++ b/tests/data/adam/adam_jip.json @@ -3,7 +3,7 @@ "06aecb3d00354375924f50c47af36bd2": { "active_preset": "no_frost", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "name": "Slaapkamer", "preset_modes": [ @@ -34,7 +34,7 @@ "13228dab8ce04617af318a2888b3c548": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "name": "Woonkamer", "preset_modes": [ @@ -263,7 +263,7 @@ "d27aede973b54be484f6842d1b2802ad": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "name": "Kinderkamer", "preset_modes": [ @@ -318,7 +318,7 @@ "d58fec52899f4f1c92e4f8fad6d8c48c": { "active_preset": "home", "climate_mode": "heat", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "name": "Logeerkamer", "preset_modes": [ diff --git a/tests/data/adam/adam_multiple_devices_per_zone.json b/tests/data/adam/adam_multiple_devices_per_zone.json index 8003bdab3..ea123e56b 100644 --- a/tests/data/adam/adam_multiple_devices_per_zone.json +++ b/tests/data/adam/adam_multiple_devices_per_zone.json @@ -1,5 +1,5 @@ { - "entities": { + "devices": { "02cf28bfec924855854c544690a609ef": { "available": true, "dev_class": "vcr_plug", @@ -32,7 +32,9 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Badkamer", "preset_modes": [ "home", @@ -57,7 +59,8 @@ "680423ff840043738f42cc7f1ff97a36" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "12493538af164a409c6a1c79e38afe1c": { "active_preset": "away", @@ -70,7 +73,9 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Bios", "preset_modes": [ "home", @@ -98,7 +103,8 @@ "secondary": [ "a2c3583e0a6349358998b760cea82d2a" ] - } + }, + "vendor": "Plugwise" }, "21f2b542c49845e6bb416884c55778d6": { "available": true, @@ -132,7 +138,9 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Garage", "preset_modes": [ "home", @@ -156,7 +164,8 @@ "e7693eb9582644e5b865dba8d4447cf1" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "4a810418d5394b3f82727340b91ba740": { "available": true, @@ -285,7 +294,9 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Jessie", "preset_modes": [ "home", @@ -311,7 +322,8 @@ "secondary": [ "d3da73bde12a47d5a6b8f9dad971f2ec" ] - } + }, + "vendor": "Plugwise" }, "90986d591dcd426cae3ec3e8111ff730": { "binary_sensors": { @@ -437,7 +449,9 @@ "off" ], "climate_mode": "auto", + "control_state": "heating", "dev_class": "climate", + "model": "ThermoZone", "name": "Woonkamer", "preset_modes": [ "home", @@ -465,7 +479,8 @@ "secondary": [ "b310b72a0e354bfab43089919b9a88bf" ] - } + }, + "vendor": "Plugwise" }, "cd0ddb54ef694e11ac18ed1cbce5dbbd": { "available": true, diff --git a/tests/data/adam/adam_onoff_cooling_fake_firmware.json b/tests/data/adam/adam_onoff_cooling_fake_firmware.json index 335ef5d01..0d152771b 100644 --- a/tests/data/adam/adam_onoff_cooling_fake_firmware.json +++ b/tests/data/adam/adam_onoff_cooling_fake_firmware.json @@ -89,7 +89,7 @@ "off" ], "climate_mode": "auto", - "control_state": "off", + "control_state": "idle", "dev_class": "climate", "name": "Woonkamer", "preset_modes": [ diff --git a/tests/data/adam/adam_plus_anna.json b/tests/data/adam/adam_plus_anna.json index e6cd0e985..3256f5a87 100644 --- a/tests/data/adam/adam_plus_anna.json +++ b/tests/data/adam/adam_plus_anna.json @@ -1,5 +1,5 @@ { - "entities": { + "devices": { "009490cc2f674ce6b576863fbb64f867": { "active_preset": "home", "available_schedules": [ @@ -7,7 +7,9 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Living room", "preset_modes": [ "home", @@ -33,7 +35,8 @@ "ee62cad889f94e8ca3d09021f03a660b" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "2743216f626f43948deec1f7ab3b3d70": { "available": false, diff --git a/tests/data/adam/adam_plus_anna_new_regulation_off.json b/tests/data/adam/adam_plus_anna_new_regulation_off.json new file mode 100644 index 000000000..e3e373186 --- /dev/null +++ b/tests/data/adam/adam_plus_anna_new_regulation_off.json @@ -0,0 +1,309 @@ +{ + "device_zones": { + "056ee145a816487eaa69243c3280f8bf": { + "available": true, + "binary_sensors": { + "dhw_state": false, + "flame_state": false, + "heating_state": false + }, + "dev_class": "heater_central", + "location": "bc93488efab249e5bc54fd7e175a6f91", + "maximum_boiler_temperature": { + "lower_bound": 25.0, + "resolution": 0.01, + "setpoint": 50.0, + "upper_bound": 95.0 + }, + "model": "Generic heater", + "name": "OpenTherm", + "sensors": { + "intended_boiler_temperature": 0.0, + "water_temperature": 30.0 + }, + "switches": { + "dhw_cm_switch": false + } + }, + "10016900610d4c7481df78c89606ef22": { + "available": true, + "dev_class": "valve_actuator_plug", + "location": "d9786723dbcf4f19b5c629a54629f9c7", + "model_id": "TS0011", + "name": "Aanvoer water afsluiter (nous lz3)", + "switches": { + "relay": false + }, + "vendor": "_TZ3000_abjodzas", + "zigbee_mac_address": "A4C13862AF9917B1" + }, + "1772a4ea304041adb83f357b751341ff": { + "available": true, + "binary_sensors": { + "low_battery": false + }, + "dev_class": "thermostatic_radiator_valve", + "firmware": "2020-11-04T01:00:00+01:00", + "hardware": "1", + "location": "f871b8c4d63549319221e294e4f88074", + "model": "Tom/Floor", + "model_id": "106-03", + "name": "Tom Badkamer", + "sensors": { + "battery": 99, + "setpoint": 18.0, + "temperature": 21.6, + "temperature_difference": -0.2, + "valve_position": 100 + }, + "temperature_offset": { + "lower_bound": -2.0, + "resolution": 0.1, + "setpoint": 0.1, + "upper_bound": 2.0 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000C8FF5EE" + }, + "2568cc4b9c1e401495d4741a5f89bee1": { + "available": true, + "dev_class": "hometheater_plug", + "firmware": "2020-11-10T01:00:00+01:00", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "Plug", + "model_id": "160-01", + "name": "Plug MediaTV", + "sensors": { + "electricity_consumed": 14.8, + "electricity_consumed_interval": 3.0, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "lock": true, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D13CCFD" + }, + "29542b2b6a6a4169acecc15c72a599b8": { + "available": true, + "dev_class": "computer_desktop_plug", + "firmware": "2020-11-10T01:00:00+01:00", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "Plug", + "model_id": "160-01", + "name": "Plug Werkplek", + "sensors": { + "electricity_consumed": 91.3, + "electricity_consumed_interval": 23.0, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "lock": false, + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D13CA9A" + }, + "67d73d0bd469422db25a618a5fb8eeb0": { + "available": true, + "dev_class": "heater_central_plug", + "location": "b4f211175e124df59603412bafa77a34", + "model": "Aqara Smart Plug", + "model_id": "lumi.plug.maeu01", + "name": "SmartPlug Floor 0", + "sensors": { + "electricity_consumed_interval": 0.0 + }, + "switches": { + "lock": false, + "relay": true + }, + "vendor": "LUMI", + "zigbee_mac_address": "54EF4410002C97F2" + }, + "854f8a9b0e7e425db97f1f110e1ce4b3": { + "available": true, + "dev_class": "central_heating_pump_plug", + "firmware": "2020-11-10T01:00:00+01:00", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "Plug", + "model_id": "160-01", + "name": "Plug Vloerverwarming", + "sensors": { + "electricity_consumed": 43.8, + "electricity_consumed_interval": 0.0, + "electricity_produced": 0.0, + "electricity_produced_interval": 0.0 + }, + "switches": { + "relay": true + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D13CB6F" + }, + "ad4838d7d35c4d6ea796ee12ae5aedf8": { + "dev_class": "thermostat", + "location": "f2bf9048bef64cc5b6d5110154e33c81", + "model": "ThermoTouch", + "model_id": "143.1", + "name": "Anna", + "sensors": { + "setpoint": 18.5, + "temperature": 22.4 + }, + "vendor": "Plugwise" + }, + "da224107914542988a88561b4452b0f6": { + "binary_sensors": { + "plugwise_notification": false + }, + "dev_class": "gateway", + "firmware": "3.7.8", + "gateway_modes": [ + "away", + "full", + "vacation" + ], + "hardware": "AME Smile 2.0 board", + "location": "bc93488efab249e5bc54fd7e175a6f91", + "mac_address": "012345679891", + "model": "Gateway", + "model_id": "smile_open_therm", + "name": "Adam", + "regulation_modes": [ + "bleeding_hot", + "bleeding_cold", + "off", + "heating" + ], + "select_gateway_mode": "full", + "select_regulation_mode": "off", + "sensors": { + "outdoor_temperature": 9.19 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000D5A168D" + }, + "e2f4322d57924fa090fbbc48b3a140dc": { + "available": true, + "binary_sensors": { + "low_battery": true + }, + "dev_class": "zone_thermostat", + "firmware": "2016-10-10T02:00:00+02:00", + "hardware": "255", + "location": "f871b8c4d63549319221e294e4f88074", + "model": "Lisa", + "model_id": "158-01", + "name": "Lisa Badkamer", + "sensors": { + "battery": 14, + "setpoint": 18.0, + "temperature": 21.5 + }, + "temperature_offset": { + "lower_bound": -2.0, + "resolution": 0.1, + "setpoint": 0.0, + "upper_bound": 2.0 + }, + "vendor": "Plugwise", + "zigbee_mac_address": "000D6F000C869B61" + }, + "e8ef2a01ed3b4139a53bf749204fe6b4": { + "dev_class": "switching", + "members": [ + "2568cc4b9c1e401495d4741a5f89bee1", + "29542b2b6a6a4169acecc15c72a599b8" + ], + "model": "Switchgroup", + "name": "Test", + "switches": { + "relay": true + } + }, + "f2bf9048bef64cc5b6d5110154e33c81": { + "active_preset": "home", + "available_schedules": [ + "Badkamer", + "Test", + "Vakantie", + "Weekschema", + "off" + ], + "climate_mode": "off", + "control_state": "idle", + "dev_class": "climate", + "name": "Living room", + "preset_modes": [ + "no_frost", + "asleep", + "vacation", + "home", + "away" + ], + "select_schedule": "off", + "sensors": { + "electricity_consumed": 149.9, + "electricity_produced": 0.0, + "temperature": 22.4 + }, + "thermostat": { + "lower_bound": 1.0, + "resolution": 0.01, + "setpoint": 18.5, + "upper_bound": 35.0 + }, + "thermostats": { + "primary": [ + "ad4838d7d35c4d6ea796ee12ae5aedf8" + ], + "secondary": [] + } + }, + "f871b8c4d63549319221e294e4f88074": { + "active_preset": "home", + "available_schedules": [ + "Badkamer", + "Test", + "Vakantie", + "Weekschema", + "off" + ], + "climate_mode": "off", + "control_state": "idle", + "dev_class": "climate", + "name": "Bathroom", + "preset_modes": [ + "no_frost", + "asleep", + "vacation", + "home", + "away" + ], + "select_schedule": "off", + "sensors": { + "electricity_consumed": 0.0, + "electricity_produced": 0.0, + "temperature": 21.5 + }, + "thermostat": { + "lower_bound": 0.0, + "resolution": 0.01, + "setpoint": 18.0, + "upper_bound": 99.9 + }, + "thermostats": { + "primary": [ + "e2f4322d57924fa090fbbc48b3a140dc" + ], + "secondary": [ + "1772a4ea304041adb83f357b751341ff" + ] + } + } + } +} diff --git a/tests/data/adam/adam_zone_per_device.json b/tests/data/adam/adam_zone_per_device.json index bb5220de9..a41b14e55 100644 --- a/tests/data/adam/adam_zone_per_device.json +++ b/tests/data/adam/adam_zone_per_device.json @@ -1,5 +1,5 @@ { - "entities": { + "devices": { "02cf28bfec924855854c544690a609ef": { "available": true, "dev_class": "vcr_plug", @@ -32,7 +32,9 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Badkamer", "preset_modes": [ "home", @@ -58,7 +60,8 @@ "secondary": [ "680423ff840043738f42cc7f1ff97a36" ] - } + }, + "vendor": "Plugwise" }, "12493538af164a409c6a1c79e38afe1c": { "active_preset": "away", @@ -71,7 +74,9 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Bios", "preset_modes": [ "home", @@ -99,7 +104,8 @@ "secondary": [ "a2c3583e0a6349358998b760cea82d2a" ] - } + }, + "vendor": "Plugwise" }, "21f2b542c49845e6bb416884c55778d6": { "available": true, @@ -133,7 +139,9 @@ "off" ], "climate_mode": "heat", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Garage", "preset_modes": [ "home", @@ -157,7 +165,8 @@ "e7693eb9582644e5b865dba8d4447cf1" ], "secondary": [] - } + }, + "vendor": "Plugwise" }, "4a810418d5394b3f82727340b91ba740": { "available": true, @@ -286,7 +295,9 @@ "off" ], "climate_mode": "auto", + "control_state": "idle", "dev_class": "climate", + "model": "ThermoZone", "name": "Jessie", "preset_modes": [ "home", @@ -312,7 +323,8 @@ "secondary": [ "d3da73bde12a47d5a6b8f9dad971f2ec" ] - } + }, + "vendor": "Plugwise" }, "90986d591dcd426cae3ec3e8111ff730": { "binary_sensors": { @@ -438,7 +450,9 @@ "off" ], "climate_mode": "auto", + "control_state": "heating", "dev_class": "climate", + "model": "ThermoZone", "name": "Woonkamer", "preset_modes": [ "home", @@ -466,7 +480,8 @@ "secondary": [ "b310b72a0e354bfab43089919b9a88bf" ] - } + }, + "vendor": "Plugwise" }, "cd0ddb54ef694e11ac18ed1cbce5dbbd": { "available": true, diff --git a/tests/test_adam.py b/tests/test_adam.py index 2bf559be7..300603962 100644 --- a/tests/test_adam.py +++ b/tests/test_adam.py @@ -18,7 +18,7 @@ class TestPlugwiseAdam(TestPlugwise): # pylint: disable=attribute-defined-outsi @pytest.mark.asyncio async def test_connect_adam_plus_anna_new(self): - """Test extended Adam (firmware 3.8) with Anna and a switch-group setup.""" + """Test extended Adam (firmware 3.7) with Anna and a switch-group setup.""" self.smile_setup = "adam_plus_anna_new" testdata = self.load_testdata(SMILE_TYPE, self.smile_setup) @@ -167,6 +167,20 @@ async def test_connect_adam_plus_anna_new(self): await smile.close_connection() await self.disconnect(server, client) + @pytest.mark.asyncio + async def test_connect_adam_plus_anna_new_regulation_off(self): + """Test regultaion_mode off with control_state key missing for Adam.""" + self.smile_setup = "adam_plus_anna_new_regulation_off" + + testdata = self.load_testdata(SMILE_TYPE, self.smile_setup) + server, smile, client = await self.connect_wrapper() + assert smile.smile_hostname == "smile000000" + + await self.device_test(smile, "2023-12-17 00:00:01", testdata) + + await smile.close_connection() + await self.disconnect(server, client) + @pytest.mark.asyncio async def test_connect_adam_zone_per_device(self): """Test an extensive setup of Adam with a zone per device.""" @@ -189,7 +203,7 @@ async def test_connect_adam_zone_per_device(self): assert smile._last_active["82fa13f017d240daa0d0ea1775420f24"] == CV_JESSIE assert smile._last_active["08963fec7c53423ca5680aa4cb502c63"] == BADKAMER_SCHEMA assert smile._last_active["446ac08dd04d4eff8ac57489757b7314"] == BADKAMER_SCHEMA - assert self.entity_items == 364 + assert self.entity_items == 369 assert "af82e4ccf9c548528166d38e560662a4" in self.notifications await smile.delete_notification() @@ -267,7 +281,7 @@ async def test_connect_adam_multiple_devices_per_zone(self): assert smile._last_active["82fa13f017d240daa0d0ea1775420f24"] == CV_JESSIE assert smile._last_active["08963fec7c53423ca5680aa4cb502c63"] == BADKAMER_SCHEMA assert smile._last_active["446ac08dd04d4eff8ac57489757b7314"] == BADKAMER_SCHEMA - assert self.entity_items == 364 + assert self.entity_items == 369 assert "af82e4ccf9c548528166d38e560662a4" in self.notifications @@ -351,7 +365,7 @@ async def test_connect_adam_plus_anna(self): await self.device_test(smile, "2020-03-22 00:00:01", testdata) assert smile.gateway_id == "b128b4bbbd1f47e9bf4d756e8fb5ee94" assert smile._last_active["009490cc2f674ce6b576863fbb64f867"] == "Weekschema" - assert self.entity_items == 79 + assert self.entity_items == 80 assert "6fb89e35caeb4b1cb275184895202d84" in self.notifications result = await self.tinker_thermostat( diff --git a/userdata/adam_plus_anna_new_regulation_off/core.domain_objects.xml b/userdata/adam_plus_anna_new_regulation_off/core.domain_objects.xml new file mode 100644 index 000000000..fcfcd28e0 --- /dev/null +++ b/userdata/adam_plus_anna_new_regulation_off/core.domain_objects.xml @@ -0,0 +1,2317 @@ + + + + Aanvoer water afsluiter (nous lz3) + A device that communicates through the ZigBee protocol. + valve_actuator + 2024-11-11T20:31:49.734+01:00 + 2024-11-15T13:55:19.574+01:00 + + + + + + + + relay + + 2024-11-15T13:55:19.571+01:00 + 2024-11-15T13:55:19.571+01:00 + + + + off + + + + + + 2024-11-15T13:55:19.571+01:00 + false + off + + + + + + _TZ3000_abjodzas + TS0011 + + + + 2024-11-11T20:31:46.189+01:00 + 2024-11-11T20:31:49.706+01:00 + + + + + + + + + + + + A4C13862AF9917B1 + end_device + true + battery + + + + 221 + 1 + parent + + + 2024-11-15T14:07:23+01:00 + true + + + + + SmartPlug Floor 0 + A device that communicates through the ZigBee protocol. + + heater_central + 2022-03-11T11:21:58.858+01:00 + 2022-06-13T15:15:12.921+02:00 + 2023-12-22T16:18:09.841+01:00 + + + + + + electricity_consumed + Wh + 2023-12-22T16:15:00+01:00 + 2023-12-22T16:00:00+01:00 + PT15M + + + 0.00 + + + + electricity_produced + Wh + + + PT15M + + + + relay + + 2023-12-22T16:18:09.841+01:00 + 2022-06-11T15:25:12.796+02:00 + + + + on + + + + + + 2023-12-22T16:18:09.841+01:00 + false + on + + + + + + LUMI + lumi.plug.maeu01 + + + + 2022-03-11T11:21:37.406+01:00 + 2022-03-11T18:44:23.929+01:00 + + + + + + + + + + + + 54EF4410002C97F2 + router + true + mains + + + + 63 + 1 + sibling + + + 75 + 1 + sibling + + + 67 + 0 + parent + + + 2023-12-22T16:24:36+01:00 + true + + + + + Lisa Badkamer + A zone thermostat regulates the temperature in a heating zone (generally a room). + zone_thermostat + 2021-12-16T19:31:01.653+01:00 + 2023-12-22T16:18:09.841+01:00 + + + + + + temperature + C + 2023-12-22T16:18:09.838+01:00 + 2023-12-22T16:18:09.838+01:00 + PT3H + + + 21.50 + + + + temperature_offset + C + 2023-12-10T15:48:43.424+01:00 + 2023-12-10T15:48:43.424+01:00 + + + + 0.00 + + + + battery + + 2023-12-22T13:59:02.810+01:00 + 2023-12-22T13:59:02.810+01:00 + + + + 0.14 + + + + thermostat + C + 2023-12-22T07:00:05.510+01:00 + 2023-12-22T07:00:05.510+01:00 + + + + 18.00 + + + + + + 2023-12-22T07:00:05.511+01:00 + thermostat + 0 + 99.9 + 0.01 + 18 + + + + + + 2023-12-10T15:48:43.425+01:00 + temperature_offset + 0 + + + + + 2021-12-16T19:30:15.976+01:00 + 2023-12-22T16:30:02.561+01:00 + + + + + + + + + economy + on + small + underfloor + false + + + + + + + Plugwise + Adam + 6539-1601-4502 + 2018-10-30T10:12:41+01:00 + 2021-12-16T19:30:19.722+01:00 + 2021-12-16T19:30:39.051+01:00 + + + + + + + + + + + + 16-50-001-505 + + + + + + + Plug Werkplek + A smart plug that can be switched on/off and measure power usage. + computer_desktop + 2021-12-16T19:30:42.936+01:00 + 2023-12-22T16:30:49.607+01:00 + + + + + + + + electricity_produced + Wh + 2023-12-22T16:15:00+01:00 + 2023-12-22T16:00:00+01:00 + PT15M + + + 0.00 + + + + electricity_produced + W + 2023-12-22T16:30:49.581+01:00 + 2023-12-22T16:30:49.581+01:00 + + + + 0.00 + + + + relay + + 2023-12-22T16:24:29.783+01:00 + 2023-12-22T16:24:29.783+01:00 + + + + on + + + + electricity_consumed + Wh + 2023-12-22T16:15:00+01:00 + 2023-12-22T16:00:00+01:00 + PT15M + + + 23.00 + + + + electricity_consumed + W + 2023-12-22T16:30:49.581+01:00 + 2023-12-22T16:30:49.581+01:00 + + + + 91.31 + + + + + + 2023-12-22T16:24:29.783+01:00 + false + on + + + + + + Badkamer + +