From 0c8884fd5178fb07f838d97790ea7665b3cadb30 Mon Sep 17 00:00:00 2001 From: Bouwe Westerdijk <11290930+bouwew@users.noreply.github.com> Date: Wed, 19 Oct 2022 11:26:27 +0200 Subject: [PATCH] Add sensor, selector and switch for Plugwise Anna + Loria combination (#80558) Co-authored-by: Franck Nijhof --- homeassistant/components/plugwise/select.py | 10 +++++++++ homeassistant/components/plugwise/sensor.py | 7 ++++++ .../components/plugwise/strings.select.json | 6 +++++ homeassistant/components/plugwise/switch.py | 6 +++++ .../plugwise/translations/select.en.json | 22 ++++++++++++------- tests/components/plugwise/test_sensor.py | 4 ++++ 6 files changed, 47 insertions(+), 8 deletions(-) diff --git a/homeassistant/components/plugwise/select.py b/homeassistant/components/plugwise/select.py index a6f49380678..73157c6a962 100644 --- a/homeassistant/components/plugwise/select.py +++ b/homeassistant/components/plugwise/select.py @@ -54,6 +54,16 @@ SELECT_TYPES = ( options_key="regulation_modes", device_class="plugwise__regulation_mode", ), + PlugwiseSelectEntityDescription( + key="select_dhw_mode", + name="DHW mode", + icon="mdi:shower", + entity_category=EntityCategory.CONFIG, + command=lambda api, loc, opt: api.set_dhw_mode(opt), + current_option_key="dhw_mode", + options_key="dhw_modes", + device_class="plugwise__dhw_mode", + ), ) diff --git a/homeassistant/components/plugwise/sensor.py b/homeassistant/components/plugwise/sensor.py index 3ee0437e8dd..0e65f617c25 100644 --- a/homeassistant/components/plugwise/sensor.py +++ b/homeassistant/components/plugwise/sensor.py @@ -263,6 +263,13 @@ SENSORS: tuple[SensorEntityDescription, ...] = ( device_class=SensorDeviceClass.HUMIDITY, state_class=SensorStateClass.MEASUREMENT, ), + SensorEntityDescription( + key="dhw_temperature", + name="DHW temperature", + native_unit_of_measurement=TEMP_CELSIUS, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, + ), ) diff --git a/homeassistant/components/plugwise/strings.select.json b/homeassistant/components/plugwise/strings.select.json index 1c278f44315..92098e3bc35 100644 --- a/homeassistant/components/plugwise/strings.select.json +++ b/homeassistant/components/plugwise/strings.select.json @@ -6,6 +6,12 @@ "cooling": "Cooling", "heating": "Heating", "off": "Off" + }, + "plugwise__dhw_mode": { + "off": "Off", + "auto": "Auto", + "boost": "Boost", + "comfort": "Comfort" } } } diff --git a/homeassistant/components/plugwise/switch.py b/homeassistant/components/plugwise/switch.py index c2942308b75..a8e5597efbf 100644 --- a/homeassistant/components/plugwise/switch.py +++ b/homeassistant/components/plugwise/switch.py @@ -36,6 +36,12 @@ SWITCHES: tuple[SwitchEntityDescription, ...] = ( name="Relay", device_class=SwitchDeviceClass.SWITCH, ), + SwitchEntityDescription( + key="cooling_ena_switch", + name="Cooling", + icon="mdi:snowflake-thermometer", + entity_category=EntityCategory.CONFIG, + ), ) diff --git a/homeassistant/components/plugwise/translations/select.en.json b/homeassistant/components/plugwise/translations/select.en.json index b71301ba047..c54a933921e 100644 --- a/homeassistant/components/plugwise/translations/select.en.json +++ b/homeassistant/components/plugwise/translations/select.en.json @@ -1,11 +1,17 @@ { "state": { - "plugwise__regulation_mode": { - "bleeding_cold": "Bleeding cold", - "bleeding_hot": "Bleeding hot", - "cooling": "Cooling", - "heating": "Heating", - "off": "Off" - } + "plugwise__regulation_mode": { + "bleeding_cold": "Bleeding cold", + "bleeding_hot": "Bleeding hot", + "cooling": "Cooling", + "heating": "Heating", + "off": "Off" + }, + "plugwise__dhw_mode": { + "off": "Off", + "auto": "Auto", + "boost": "Boost", + "comfort": "Comfort" + } } -} \ No newline at end of file + } \ No newline at end of file diff --git a/tests/components/plugwise/test_sensor.py b/tests/components/plugwise/test_sensor.py index 2b4baccc7c9..9039c5a476e 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_temperature") + assert state + assert float(state.state) == 46.3 + state = hass.states.get("sensor.anna_illuminance") assert state assert float(state.state) == 86.0