mirror of
https://github.com/home-assistant/core.git
synced 2025-04-25 01:38:02 +00:00
Use climate enums in overkiz (#70731)
This commit is contained in:
parent
c4eeeb9674
commit
ae5ec1a320
@ -5,26 +5,23 @@ from typing import cast
|
||||
|
||||
from pyoverkiz.enums import OverkizCommand, OverkizCommandParam, OverkizState
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
HVAC_MODE_OFF,
|
||||
ClimateEntity,
|
||||
ClimateEntityFeature,
|
||||
)
|
||||
from homeassistant.components.climate import ClimateEntity
|
||||
from homeassistant.components.climate.const import (
|
||||
HVAC_MODE_HEAT,
|
||||
PRESET_COMFORT,
|
||||
PRESET_ECO,
|
||||
PRESET_NONE,
|
||||
ClimateEntityFeature,
|
||||
HVACMode,
|
||||
)
|
||||
from homeassistant.components.overkiz.entity import OverkizEntity
|
||||
from homeassistant.const import TEMP_CELSIUS
|
||||
|
||||
PRESET_FROST_PROTECTION = "frost_protection"
|
||||
|
||||
OVERKIZ_TO_HVAC_MODES: dict[str, str] = {
|
||||
OverkizCommandParam.ON: HVAC_MODE_HEAT,
|
||||
OverkizCommandParam.COMFORT: HVAC_MODE_HEAT,
|
||||
OverkizCommandParam.OFF: HVAC_MODE_OFF,
|
||||
OVERKIZ_TO_HVAC_MODES: dict[str, HVACMode] = {
|
||||
OverkizCommandParam.ON: HVACMode.HEAT,
|
||||
OverkizCommandParam.COMFORT: HVACMode.HEAT,
|
||||
OverkizCommandParam.OFF: HVACMode.OFF,
|
||||
}
|
||||
HVAC_MODES_TO_OVERKIZ = {v: k for k, v in OVERKIZ_TO_HVAC_MODES.items()}
|
||||
|
||||
@ -47,13 +44,13 @@ class AtlanticElectricalHeater(OverkizEntity, ClimateEntity):
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
|
||||
@property
|
||||
def hvac_mode(self) -> str:
|
||||
def hvac_mode(self) -> HVACMode:
|
||||
"""Return hvac operation ie. heat, cool mode."""
|
||||
return OVERKIZ_TO_HVAC_MODES[
|
||||
cast(str, self.executor.select_state(OverkizState.CORE_ON_OFF))
|
||||
]
|
||||
|
||||
async def async_set_hvac_mode(self, hvac_mode: str) -> None:
|
||||
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
|
||||
"""Set new target hvac mode."""
|
||||
await self.executor.async_execute_command(
|
||||
OverkizCommand.SET_HEATING_LEVEL, HVAC_MODES_TO_OVERKIZ[hvac_mode]
|
||||
|
Loading…
x
Reference in New Issue
Block a user