Populate HVACAction/HVACMode for TouchlineSL zones (#131075)

This commit is contained in:
Per Øyvind Øygard 2024-11-22 15:27:25 +01:00 committed by GitHub
parent 7fba788f18
commit 11ef2b6da8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,7 @@ from pytouchlinesl import Zone
from homeassistant.components.climate import (
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
@ -41,6 +42,7 @@ class TouchlineSLZone(CoordinatorEntity[TouchlineSLModuleCoordinator], ClimateEn
"""Roth Touchline SL Zone."""
_attr_has_entity_name = True
_attr_hvac_action = HVACAction.IDLE
_attr_hvac_mode = HVACMode.HEAT
_attr_hvac_modes = [HVACMode.HEAT]
_attr_name = None
@ -124,3 +126,16 @@ class TouchlineSLZone(CoordinatorEntity[TouchlineSLModuleCoordinator], ClimateEn
elif self.zone.mode == "globalSchedule":
schedule = self.zone.schedule
self._attr_preset_mode = schedule.name
if self.zone.algorithm == "heating":
self._attr_hvac_action = (
HVACAction.HEATING if self.zone.relay_on else HVACAction.IDLE
)
self._attr_hvac_mode = HVACMode.HEAT
self._attr_hvac_modes = [HVACMode.HEAT]
elif self.zone.algorithm == "cooling":
self._attr_hvac_action = (
HVACAction.COOLING if self.zone.relay_on else HVACAction.IDLE
)
self._attr_hvac_mode = HVACMode.COOL
self._attr_hvac_modes = [HVACMode.COOL]