From 620b653d76c0b5ee68b4f96b2fea07f4d20dbbad Mon Sep 17 00:00:00 2001 From: Tom Date: Sun, 20 Feb 2022 20:45:19 +0100 Subject: [PATCH] Plugwise bump module version to fix heating-state and OnOff devices (#66936) --- homeassistant/components/plugwise/climate.py | 7 ++++--- homeassistant/components/plugwise/const.py | 1 - homeassistant/components/plugwise/gateway.py | 15 ++------------- homeassistant/components/plugwise/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../adam_multiple_devices_per_zone/all_data.json | 11 +++++------ .../plugwise/fixtures/anna_heatpump/all_data.json | 14 ++++++-------- .../fixtures/p1v3_full_option/all_data.json | 6 +----- .../plugwise/fixtures/stretch_v31/all_data.json | 6 +----- tests/components/plugwise/test_diagnostics.py | 9 +++------ 11 files changed, 25 insertions(+), 50 deletions(-) diff --git a/homeassistant/components/plugwise/climate.py b/homeassistant/components/plugwise/climate.py index c4c444441c2..e22f12c3526 100644 --- a/homeassistant/components/plugwise/climate.py +++ b/homeassistant/components/plugwise/climate.py @@ -107,15 +107,16 @@ class PlugwiseClimateEntity(PlugwiseEntity, ClimateEntity): if "control_state" in self.device: if self.device.get("control_state") == "cooling": return CURRENT_HVAC_COOL - if self.device.get("control_state") == "heating": + # Support preheating state as heating, until preheating is added as a separate state + if self.device.get("control_state") in ["heating", "preheating"]: return CURRENT_HVAC_HEAT else: heater_central_data = self.coordinator.data.devices[ self.coordinator.data.gateway["heater_id"] ] - if heater_central_data.get("heating_state"): + if heater_central_data["binary_sensors"].get("heating_state"): return CURRENT_HVAC_HEAT - if heater_central_data.get("cooling_state"): + if heater_central_data["binary_sensors"].get("cooling_state"): return CURRENT_HVAC_COOL return CURRENT_HVAC_IDLE diff --git a/homeassistant/components/plugwise/const.py b/homeassistant/components/plugwise/const.py index ab4bde47d91..adcd68ed50e 100644 --- a/homeassistant/components/plugwise/const.py +++ b/homeassistant/components/plugwise/const.py @@ -25,7 +25,6 @@ PLATFORMS_GATEWAY = [ Platform.SENSOR, Platform.SWITCH, ] -SENSOR_PLATFORMS = [Platform.SENSOR, Platform.SWITCH] ZEROCONF_MAP = { "smile": "P1", "smile_thermo": "Anna", diff --git a/homeassistant/components/plugwise/gateway.py b/homeassistant/components/plugwise/gateway.py index 05ef937c6fd..71ca2af9537 100644 --- a/homeassistant/components/plugwise/gateway.py +++ b/homeassistant/components/plugwise/gateway.py @@ -16,14 +16,7 @@ from homeassistant.helpers import device_registry as dr from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.entity_registry import RegistryEntry, async_migrate_entries -from .const import ( - DEFAULT_PORT, - DEFAULT_USERNAME, - DOMAIN, - LOGGER, - PLATFORMS_GATEWAY, - SENSOR_PLATFORMS, -) +from .const import DEFAULT_PORT, DEFAULT_USERNAME, DOMAIN, LOGGER, PLATFORMS_GATEWAY from .coordinator import PlugwiseDataUpdateCoordinator @@ -77,11 +70,7 @@ async def async_setup_entry_gw(hass: HomeAssistant, entry: ConfigEntry) -> bool: sw_version=api.smile_version[0], ) - platforms = PLATFORMS_GATEWAY - if coordinator.data.gateway["single_master_thermostat"] is None: - platforms = SENSOR_PLATFORMS - - hass.config_entries.async_setup_platforms(entry, platforms) + hass.config_entries.async_setup_platforms(entry, PLATFORMS_GATEWAY) return True diff --git a/homeassistant/components/plugwise/manifest.json b/homeassistant/components/plugwise/manifest.json index b7db3880a5e..4f1417ae018 100644 --- a/homeassistant/components/plugwise/manifest.json +++ b/homeassistant/components/plugwise/manifest.json @@ -2,7 +2,7 @@ "domain": "plugwise", "name": "Plugwise", "documentation": "https://www.home-assistant.io/integrations/plugwise", - "requirements": ["plugwise==0.16.5"], + "requirements": ["plugwise==0.16.6"], "codeowners": ["@CoMPaTech", "@bouwew", "@brefra", "@frenck"], "zeroconf": ["_plugwise._tcp.local."], "config_flow": true, diff --git a/requirements_all.txt b/requirements_all.txt index 08c4a43bef9..daf0559cde6 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1267,7 +1267,7 @@ plexauth==0.0.6 plexwebsocket==0.0.13 # homeassistant.components.plugwise -plugwise==0.16.5 +plugwise==0.16.6 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index ff80c8a8366..a79ce5ce6b7 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -795,7 +795,7 @@ plexauth==0.0.6 plexwebsocket==0.0.13 # homeassistant.components.plugwise -plugwise==0.16.5 +plugwise==0.16.6 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 diff --git a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json index 925571908c5..65b96074cc0 100644 --- a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json +++ b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json @@ -1,11 +1,9 @@ [ { - "active_device": true, - "cooling_present": false, + "smile_name": "Adam", "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "single_master_thermostat": false, - "smile_name": "Adam", + "cooling_present": false, "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." @@ -260,8 +258,9 @@ "lower_bound": 10, "upper_bound": 90, "resolution": 1, - "cooling_active": false, - "heating_state": true, + "binary_sensors": { + "heating_state": true + }, "sensors": { "water_temperature": 70.0, "intended_boiler_temperature": 70.0, diff --git a/tests/components/plugwise/fixtures/anna_heatpump/all_data.json b/tests/components/plugwise/fixtures/anna_heatpump/all_data.json index 9585c8630af..e9e62b77bb0 100644 --- a/tests/components/plugwise/fixtures/anna_heatpump/all_data.json +++ b/tests/components/plugwise/fixtures/anna_heatpump/all_data.json @@ -1,11 +1,9 @@ [ { - "active_device": true, - "cooling_present": true, + "smile_name": "Anna", "gateway_id": "015ae9ea3f964e668e490fa39da3870b", "heater_id": "1cbf783bb11e4a7c8a6843dee3a86927", - "single_master_thermostat": true, - "smile_name": "Anna", + "cooling_present": true, "notifications": {} }, { @@ -21,12 +19,11 @@ "lower_bound": -10, "upper_bound": 40, "resolution": 1, - "heating_state": true, "compressor_state": true, - "cooling_state": false, - "cooling_active": false, "binary_sensors": { "dhw_state": false, + "heating_state": true, + "cooling_state": false, "slave_boiler_state": false, "flame_state": false }, @@ -40,7 +37,8 @@ }, "switches": { "dhw_cm_switch": false - } + }, + "cooling_active": false }, "015ae9ea3f964e668e490fa39da3870b": { "class": "gateway", diff --git a/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json b/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json index e65c012da85..fc565ef6040 100644 --- a/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json +++ b/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json @@ -1,11 +1,7 @@ [ { - "active_device": false, - "cooling_present": false, - "gateway_id": "e950c7d5e1ee407a858e2a8b5016c8b3", - "heater_id": null, - "single_master_thermostat": false, "smile_name": "P1", + "gateway_id": "e950c7d5e1ee407a858e2a8b5016c8b3", "notifications": {} }, { diff --git a/tests/components/plugwise/fixtures/stretch_v31/all_data.json b/tests/components/plugwise/fixtures/stretch_v31/all_data.json index 494ff28b118..21d7a888dd5 100644 --- a/tests/components/plugwise/fixtures/stretch_v31/all_data.json +++ b/tests/components/plugwise/fixtures/stretch_v31/all_data.json @@ -1,11 +1,7 @@ [ { - "active_device": false, - "cooling_present": false, - "gateway_id": "0000aaaa0000aaaa0000aaaa0000aa00", - "heater_id": null, - "single_master_thermostat": false, "smile_name": "Stretch", + "gateway_id": "0000aaaa0000aaaa0000aaaa0000aa00", "notifications": {} }, { diff --git a/tests/components/plugwise/test_diagnostics.py b/tests/components/plugwise/test_diagnostics.py index 6f4e7124d70..67ab7728d1c 100644 --- a/tests/components/plugwise/test_diagnostics.py +++ b/tests/components/plugwise/test_diagnostics.py @@ -20,12 +20,10 @@ async def test_diagnostics( hass, hass_client, init_integration ) == { "gateway": { - "active_device": True, - "cooling_present": False, + "smile_name": "Adam", "gateway_id": "fe799307f1624099878210aa0b9f1475", "heater_id": "90986d591dcd426cae3ec3e8111ff730", - "single_master_thermostat": False, - "smile_name": "Adam", + "cooling_present": False, "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." @@ -221,8 +219,7 @@ async def test_diagnostics( "lower_bound": 10, "upper_bound": 90, "resolution": 1, - "cooling_active": False, - "heating_state": True, + "binary_sensors": {"heating_state": True}, "sensors": { "water_temperature": 70.0, "intended_boiler_temperature": 70.0,