Set Cozytouch hvac action from regulation mode in Overkiz (#143363)

Set cozytouch hvac action from regulation mode
pull/143335/head^2
Adrien Cognee 2025-04-20 22:01:38 +02:00 committed by GitHub
parent 931161b007
commit e86bffdf89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 0 deletions

View File

@ -13,6 +13,7 @@ from homeassistant.components.climate import (
PRESET_NONE,
ClimateEntity,
ClimateEntityFeature,
HVACAction,
HVACMode,
)
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
@ -56,6 +57,12 @@ OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
OverkizCommandParam.INTERNAL: HVACMode.AUTO,
}
OVERKIZ_TO_HVAC_ACTION: dict[str, HVACAction] = {
OverkizCommandParam.STANDBY: HVACAction.IDLE,
OverkizCommandParam.INCREASE: HVACAction.HEATING,
OverkizCommandParam.NONE: HVACAction.OFF,
}
HVAC_MODE_TO_OVERKIZ = {v: k for k, v in OVERKIZ_TO_HVAC_MODE.items()}
TEMPERATURE_SENSOR_DEVICE_INDEX = 2
@ -102,6 +109,14 @@ class AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint(
OverkizCommand.SET_OPERATING_MODE, HVAC_MODE_TO_OVERKIZ[hvac_mode]
)
@property
def hvac_action(self) -> HVACAction:
"""Return the current running hvac operation ie. heating, idle, off."""
states = self.device.states
if (state := states[OverkizState.CORE_REGULATION_MODE]) and state.value_as_str:
return OVERKIZ_TO_HVAC_ACTION[state.value_as_str]
return HVACAction.OFF
@property
def preset_mode(self) -> str | None:
"""Return the current preset mode, e.g., home, away, temp."""