diff --git a/homeassistant/components/overkiz/climate/__init__.py b/homeassistant/components/overkiz/climate/__init__.py index 97840df7a41a68..38ec8c48620a0f 100644 --- a/homeassistant/components/overkiz/climate/__init__.py +++ b/homeassistant/components/overkiz/climate/__init__.py @@ -27,6 +27,7 @@ from .atlantic_pass_apc_heating_zone import AtlanticPassAPCHeatingZone from .atlantic_pass_apc_zone_control import AtlanticPassAPCZoneControl from .atlantic_pass_apc_zone_control_zone import AtlanticPassAPCZoneControlZone +from .heating_set_point import HeatingSetPoint from .hitachi_air_to_air_heat_pump_hlrrwifi import HitachiAirToAirHeatPumpHLRRWIFI from .hitachi_air_to_air_heat_pump_ovp import HitachiAirToAirHeatPumpOVP from .somfy_heating_temperature_interface import SomfyHeatingTemperatureInterface @@ -53,6 +54,7 @@ class Controllable(StrEnum): UIWidget.ATLANTIC_HEAT_RECOVERY_VENTILATION: AtlanticHeatRecoveryVentilation, UIWidget.ATLANTIC_PASS_APC_HEATING_ZONE: AtlanticPassAPCHeatingZone, UIWidget.ATLANTIC_PASS_APC_ZONE_CONTROL: AtlanticPassAPCZoneControl, + UIWidget.HEATING_SET_POINT: HeatingSetPoint, UIWidget.SOMFY_HEATING_TEMPERATURE_INTERFACE: SomfyHeatingTemperatureInterface, UIWidget.SOMFY_THERMOSTAT: SomfyThermostat, UIWidget.VALVE_HEATING_TEMPERATURE_INTERFACE: ValveHeatingTemperatureInterface, diff --git a/homeassistant/components/overkiz/climate/heating_set_point.py b/homeassistant/components/overkiz/climate/heating_set_point.py new file mode 100644 index 00000000000000..c855518ab83b7e --- /dev/null +++ b/homeassistant/components/overkiz/climate/heating_set_point.py @@ -0,0 +1,82 @@ +"""Support for EvoHome HeatingSetPoint.""" + +from __future__ import annotations + +from typing import Any, cast + +from pyoverkiz.enums import OverkizAttribute, OverkizCommand, OverkizState + +from homeassistant.components.climate import ( + ClimateEntity, + ClimateEntityFeature, + HVACMode, +) +from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature + +from ..const import OVERKIZ_UNIT_TO_HA +from ..entity import OverkizDataUpdateCoordinator, OverkizEntity + + +class HeatingSetPoint(OverkizEntity, ClimateEntity): + """Representation of EvoHome HeatingSetPoint device.""" + + _attr_hvac_mode = HVACMode.HEAT + _attr_hvac_modes = [HVACMode.HEAT] + _attr_supported_features = ClimateEntityFeature.TARGET_TEMPERATURE + _attr_target_temperature_step = 0.5 + + def __init__( + self, device_url: str, coordinator: OverkizDataUpdateCoordinator + ) -> None: + """Init method.""" + super().__init__(device_url, coordinator) + + if ( + self.device.attributes + and OverkizAttribute.CORE_MEASURED_VALUE_TYPE in self.device.attributes + ): + attribute = self.device.attributes[ + OverkizAttribute.CORE_MEASURED_VALUE_TYPE + ] + + self._attr_temperature_unit = OVERKIZ_UNIT_TO_HA[attribute.value_as_str] + else: + self._attr_temperature_unit = UnitOfTemperature.CELSIUS + + self._attr_min_temp = self.device.attributes[ + OverkizAttribute.CORE_MIN_SETTABLE_VALUE + ].value_as_float + self._attr_max_temp = self.device.attributes[ + OverkizAttribute.CORE_MAX_SETTABLE_VALUE + ].value_as_float + + if self._attr_device_info: + self._attr_device_info["manufacturer"] = "EvoHome" + + @property + def current_temperature(self) -> float | None: + """Return the current temperature.""" + current_temperature = self.device.states[OverkizState.CORE_TEMPERATURE] + + if current_temperature: + return current_temperature.value_as_float + + return None + + @property + def target_temperature(self) -> float | None: + """Return the temperature we try to reach.""" + target_temperature = self.device.states[OverkizState.CORE_TARGET_TEMPERATURE] + + if target_temperature: + return target_temperature.value_as_float + + return None + + async def async_set_temperature(self, **kwargs: Any) -> None: + """Set new target temperature.""" + temperature = cast(float, kwargs.get(ATTR_TEMPERATURE)) + + await self.executor.async_execute_command( + OverkizCommand.SET_TARGET_TEMPERATURE, temperature + ) diff --git a/homeassistant/components/overkiz/const.py b/homeassistant/components/overkiz/const.py index a90260e0f0f7f8..f5be37a95e1e61 100644 --- a/homeassistant/components/overkiz/const.py +++ b/homeassistant/components/overkiz/const.py @@ -101,6 +101,7 @@ UIWidget.ATLANTIC_PASS_APC_ZONE_CONTROL: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported) UIWidget.DOMESTIC_HOT_WATER_PRODUCTION: Platform.WATER_HEATER, # widgetName, uiClass is WaterHeatingSystem (not supported) UIWidget.DOMESTIC_HOT_WATER_TANK: Platform.SWITCH, # widgetName, uiClass is WaterHeatingSystem (not supported) + UIWidget.HEATING_SET_POINT: Platform.CLIMATE, # widgetName, uiClass is EvoHome (not supported) UIWidget.HITACHI_AIR_TO_AIR_HEAT_PUMP: Platform.CLIMATE, # widgetName, uiClass is HeatingSystem (not supported) UIWidget.HITACHI_DHW: Platform.WATER_HEATER, # widgetName, uiClass is HitachiHeatingSystem (not supported) UIWidget.MY_FOX_ALARM_CONTROLLER: Platform.ALARM_CONTROL_PANEL, # widgetName, uiClass is Alarm (not supported)