Skip to content

Commit

Permalink
Add initial HeatingSetPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
iMicknl committed Dec 22, 2024
1 parent 0c24afe commit d821392
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 0 deletions.
2 changes: 2 additions & 0 deletions homeassistant/components/overkiz/climate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
82 changes: 82 additions & 0 deletions homeassistant/components/overkiz/climate/heating_set_point.py
Original file line number Diff line number Diff line change
@@ -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
)
1 change: 1 addition & 0 deletions homeassistant/components/overkiz/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d821392

Please sign in to comment.