From 2c4f9ca0374d5740c4708d53077271cb9a78ac7f Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk <11290930+bouwew@users.noreply.github.com> Date: Mon, 5 Dec 2022 20:17:19 +0100 Subject: [PATCH] Update plugwise to v0.25.14, improve number detection (#83345) fixes undefined --- homeassistant/components/plugwise/manifest.json | 2 +- homeassistant/components/plugwise/number.py | 2 +- homeassistant/components/plugwise/sensor.py | 16 ++++++++++++++++ requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- .../fixtures/anna_heatpump_heating/all_data.json | 3 ++- .../m_anna_heatpump_cooling/all_data.json | 11 ++++++----- tests/components/plugwise/test_sensor.py | 4 ++++ 8 files changed, 32 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/plugwise/manifest.json b/homeassistant/components/plugwise/manifest.json index 6a11b47da57..e10d86f2779 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.25.12"], + "requirements": ["plugwise==0.25.14"], "codeowners": ["@CoMPaTech", "@bouwew", "@brefra", "@frenck"], "zeroconf": ["_plugwise._tcp.local."], "config_flow": true, diff --git a/homeassistant/components/plugwise/number.py b/homeassistant/components/plugwise/number.py index 9100e006968..0b8c7f820b4 100644 --- a/homeassistant/components/plugwise/number.py +++ b/homeassistant/components/plugwise/number.py @@ -71,7 +71,7 @@ async def async_setup_entry( entities: list[PlugwiseNumberEntity] = [] for device_id, device in coordinator.data.devices.items(): for description in NUMBER_TYPES: - if description.key in device: + if description.key in device and "setpoint" in device[description.key]: entities.append( PlugwiseNumberEntity(coordinator, device_id, description) ) diff --git a/homeassistant/components/plugwise/sensor.py b/homeassistant/components/plugwise/sensor.py index b6e2a3aa413..a59eb0cfc39 100644 --- a/homeassistant/components/plugwise/sensor.py +++ b/homeassistant/components/plugwise/sensor.py @@ -301,6 +301,22 @@ SENSORS: tuple[SensorEntityDescription, ...] = ( entity_category=EntityCategory.DIAGNOSTIC, state_class=SensorStateClass.MEASUREMENT, ), + SensorEntityDescription( + key="domestic_hot_water_setpoint", + name="DHW setpoint", + native_unit_of_measurement=TEMP_CELSIUS, + device_class=SensorDeviceClass.TEMPERATURE, + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + ), + SensorEntityDescription( + key="maximum_boiler_temperature", + name="Maximum boiler temperature", + native_unit_of_measurement=TEMP_CELSIUS, + device_class=SensorDeviceClass.TEMPERATURE, + entity_category=EntityCategory.DIAGNOSTIC, + state_class=SensorStateClass.MEASUREMENT, + ), ) diff --git a/requirements_all.txt b/requirements_all.txt index 94fbfad8d19..68fc6dd443b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1335,7 +1335,7 @@ plexauth==0.0.6 plexwebsocket==0.0.13 # homeassistant.components.plugwise -plugwise==0.25.12 +plugwise==0.25.14 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index bc8ac364046..ed35ce91ebb 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -962,7 +962,7 @@ plexauth==0.0.6 plexwebsocket==0.0.13 # homeassistant.components.plugwise -plugwise==0.25.12 +plugwise==0.25.14 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 diff --git a/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json b/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json index 1dc0fb6f2ad..f00293a6554 100644 --- a/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json +++ b/tests/components/plugwise/fixtures/anna_heatpump_heating/all_data.json @@ -30,8 +30,9 @@ }, "sensors": { "water_temperature": 29.1, + "domestic_hot_water_setpoint": 60.0, "dhw_temperature": 46.3, - "intended_boiler_temperature": 0.0, + "intended_boiler_temperature": 35.0, "modulation_level": 52, "return_temperature": 25.1, "water_pressure": 1.57, diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json index cb9e340efb8..ba980a7fce3 100644 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json +++ b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/all_data.json @@ -30,13 +30,14 @@ "flame_state": false }, "sensors": { - "water_temperature": 29.1, - "dhw_temperature": 46.3, + "water_temperature": 22.7, + "domestic_hot_water_setpoint": 60.0, + "dhw_temperature": 41.5, "intended_boiler_temperature": 0.0, - "modulation_level": 52, - "return_temperature": 25.1, + "modulation_level": 40, + "return_temperature": 23.8, "water_pressure": 1.57, - "outdoor_air_temperature": 3.0 + "outdoor_air_temperature": 28.0 }, "switches": { "dhw_cm_switch": false diff --git a/tests/components/plugwise/test_sensor.py b/tests/components/plugwise/test_sensor.py index 9039c5a476e..b08c2113d80 100644 --- a/tests/components/plugwise/test_sensor.py +++ b/tests/components/plugwise/test_sensor.py @@ -47,6 +47,10 @@ async def test_anna_as_smt_climate_sensor_entities( assert state assert float(state.state) == 29.1 + state = hass.states.get("sensor.opentherm_dhw_setpoint") + assert state + assert float(state.state) == 60.0 + state = hass.states.get("sensor.opentherm_dhw_temperature") assert state assert float(state.state) == 46.3