From b23297bb7eb0e4625238cbc74111c727258a9fcf Mon Sep 17 00:00:00 2001 From: Christopher Fenner <9592452+CFenner@users.noreply.github.com> Date: Wed, 4 Sep 2024 20:32:40 +0200 Subject: [PATCH] Add hysteresis entity for heat pumps via ViCare (#124294) * add hysteresis entity * update PyViCare-neo dependency * add hysteresis switch on / of entities * Revert "add hysteresis entity" This reverts commit dcb5680d0ca1958640e68de36f6befbf6416ab41. --- homeassistant/components/vicare/manifest.json | 2 +- homeassistant/components/vicare/number.py | 28 +++++++++++++++++++ homeassistant/components/vicare/strings.json | 6 ++++ requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/vicare/manifest.json b/homeassistant/components/vicare/manifest.json index 186e9ef6289..7a3089d04c3 100644 --- a/homeassistant/components/vicare/manifest.json +++ b/homeassistant/components/vicare/manifest.json @@ -11,5 +11,5 @@ "documentation": "https://www.home-assistant.io/integrations/vicare", "iot_class": "cloud_polling", "loggers": ["PyViCare"], - "requirements": ["PyViCare-neo==0.2.1"] + "requirements": ["PyViCare-neo==0.3.0"] } diff --git a/homeassistant/components/vicare/number.py b/homeassistant/components/vicare/number.py index ea64fb174e8..a7f679f7224 100644 --- a/homeassistant/components/vicare/number.py +++ b/homeassistant/components/vicare/number.py @@ -75,6 +75,34 @@ DEVICE_ENTITY_DESCRIPTIONS: tuple[ViCareNumberEntityDescription, ...] = ( native_max_value=60, native_step=1, ), + ViCareNumberEntityDescription( + key="dhw_hysteresis_switch_on", + translation_key="dhw_hysteresis_switch_on", + entity_category=EntityCategory.CONFIG, + device_class=NumberDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.KELVIN, + value_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOn(), + value_setter=lambda api, value: api.setDomesticHotWaterHysteresisSwitchOn( + value + ), + min_value_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOnMin(), + max_value_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOnMax(), + stepping_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOnStepping(), + ), + ViCareNumberEntityDescription( + key="dhw_hysteresis_switch_off", + translation_key="dhw_hysteresis_switch_off", + entity_category=EntityCategory.CONFIG, + device_class=NumberDeviceClass.TEMPERATURE, + native_unit_of_measurement=UnitOfTemperature.KELVIN, + value_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOff(), + value_setter=lambda api, value: api.setDomesticHotWaterHysteresisSwitchOff( + value + ), + min_value_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOffMin(), + max_value_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOffMax(), + stepping_getter=lambda api: api.getDomesticHotWaterHysteresisSwitchOffStepping(), + ), ) diff --git a/homeassistant/components/vicare/strings.json b/homeassistant/components/vicare/strings.json index 1466baab8f3..752645137df 100644 --- a/homeassistant/components/vicare/strings.json +++ b/homeassistant/components/vicare/strings.json @@ -110,6 +110,12 @@ }, "dhw_secondary_temperature": { "name": "DHW secondary temperature" + }, + "dhw_hysteresis_switch_on": { + "name": "DHW hysteresis switch on" + }, + "dhw_hysteresis_switch_off": { + "name": "DHW hysteresis switch off" } }, "sensor": { diff --git a/requirements_all.txt b/requirements_all.txt index 3707b52fc59..e95011f247b 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -100,7 +100,7 @@ PyTransportNSW==0.1.1 PyTurboJPEG==1.7.5 # homeassistant.components.vicare -PyViCare-neo==0.2.1 +PyViCare-neo==0.3.0 # homeassistant.components.xiaomi_aqara PyXiaomiGateway==0.14.3 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c7a11044f50..1657969b7e5 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -94,7 +94,7 @@ PyTransportNSW==0.1.1 PyTurboJPEG==1.7.5 # homeassistant.components.vicare -PyViCare-neo==0.2.1 +PyViCare-neo==0.3.0 # homeassistant.components.xiaomi_aqara PyXiaomiGateway==0.14.3