mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Fix HAVCMode typing in Overkiz (#94632)
This commit is contained in:
parent
886dea59c3
commit
1d3a7512d8
@ -45,7 +45,7 @@ OVERKIZ_TO_PRESET_MODE: dict[str, str] = {
|
|||||||
PRESET_MODE_TO_OVERKIZ = {v: k for k, v in OVERKIZ_TO_PRESET_MODE.items()}
|
PRESET_MODE_TO_OVERKIZ = {v: k for k, v in OVERKIZ_TO_PRESET_MODE.items()}
|
||||||
|
|
||||||
# Map Overkiz HVAC modes to Home Assistant HVAC modes
|
# Map Overkiz HVAC modes to Home Assistant HVAC modes
|
||||||
OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
|
OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
|
||||||
OverkizCommandParam.ON: HVACMode.HEAT,
|
OverkizCommandParam.ON: HVACMode.HEAT,
|
||||||
OverkizCommandParam.OFF: HVACMode.OFF,
|
OverkizCommandParam.OFF: HVACMode.OFF,
|
||||||
OverkizCommandParam.AUTO: HVACMode.AUTO,
|
OverkizCommandParam.AUTO: HVACMode.AUTO,
|
||||||
@ -83,7 +83,7 @@ class AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint(
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> str:
|
def hvac_mode(self) -> HVACMode:
|
||||||
"""Return hvac operation ie. heat, cool mode."""
|
"""Return hvac operation ie. heat, cool mode."""
|
||||||
states = self.device.states
|
states = self.device.states
|
||||||
if (state := states[OverkizState.CORE_OPERATING_MODE]) and state.value_as_str:
|
if (state := states[OverkizState.CORE_OPERATING_MODE]) and state.value_as_str:
|
||||||
|
@ -20,7 +20,7 @@ from ..entity import OverkizEntity
|
|||||||
|
|
||||||
PRESET_DRYING = "drying"
|
PRESET_DRYING = "drying"
|
||||||
|
|
||||||
OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
|
OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
|
||||||
OverkizCommandParam.EXTERNAL: HVACMode.HEAT, # manu
|
OverkizCommandParam.EXTERNAL: HVACMode.HEAT, # manu
|
||||||
OverkizCommandParam.INTERNAL: HVACMode.AUTO, # prog
|
OverkizCommandParam.INTERNAL: HVACMode.AUTO, # prog
|
||||||
OverkizCommandParam.STANDBY: HVACMode.OFF,
|
OverkizCommandParam.STANDBY: HVACMode.OFF,
|
||||||
@ -62,7 +62,7 @@ class AtlanticElectricalTowelDryer(OverkizEntity, ClimateEntity):
|
|||||||
self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE
|
self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> str:
|
def hvac_mode(self) -> HVACMode:
|
||||||
"""Return hvac operation ie. heat, cool mode."""
|
"""Return hvac operation ie. heat, cool mode."""
|
||||||
if OverkizState.CORE_OPERATING_MODE in self.device.states:
|
if OverkizState.CORE_OPERATING_MODE in self.device.states:
|
||||||
return OVERKIZ_TO_HVAC_MODE[
|
return OVERKIZ_TO_HVAC_MODE[
|
||||||
@ -71,7 +71,7 @@ class AtlanticElectricalTowelDryer(OverkizEntity, ClimateEntity):
|
|||||||
|
|
||||||
return HVACMode.OFF
|
return HVACMode.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."""
|
"""Set new target hvac mode."""
|
||||||
await self.executor.async_execute_command(
|
await self.executor.async_execute_command(
|
||||||
OverkizCommand.SET_TOWEL_DRYER_OPERATING_MODE,
|
OverkizCommand.SET_TOWEL_DRYER_OPERATING_MODE,
|
||||||
|
@ -21,7 +21,7 @@ from ..const import DOMAIN
|
|||||||
from ..coordinator import OverkizDataUpdateCoordinator
|
from ..coordinator import OverkizDataUpdateCoordinator
|
||||||
from ..entity import OverkizEntity
|
from ..entity import OverkizEntity
|
||||||
|
|
||||||
OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
|
OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
|
||||||
OverkizCommandParam.AUTO: HVACMode.AUTO,
|
OverkizCommandParam.AUTO: HVACMode.AUTO,
|
||||||
OverkizCommandParam.ECO: HVACMode.AUTO,
|
OverkizCommandParam.ECO: HVACMode.AUTO,
|
||||||
OverkizCommandParam.MANU: HVACMode.HEAT,
|
OverkizCommandParam.MANU: HVACMode.HEAT,
|
||||||
@ -101,7 +101,7 @@ class AtlanticPassAPCHeatingZone(OverkizEntity, ClimateEntity):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> str:
|
def hvac_mode(self) -> HVACMode:
|
||||||
"""Return hvac operation ie. heat, cool mode."""
|
"""Return hvac operation ie. heat, cool mode."""
|
||||||
return OVERKIZ_TO_HVAC_MODE[
|
return OVERKIZ_TO_HVAC_MODE[
|
||||||
cast(str, self.executor.select_state(OverkizState.IO_PASS_APC_HEATING_MODE))
|
cast(str, self.executor.select_state(OverkizState.IO_PASS_APC_HEATING_MODE))
|
||||||
@ -135,7 +135,7 @@ class AtlanticPassAPCHeatingZone(OverkizEntity, ClimateEntity):
|
|||||||
OverkizCommand.REFRESH_PASS_APC_HEATING_PROFILE
|
OverkizCommand.REFRESH_PASS_APC_HEATING_PROFILE
|
||||||
)
|
)
|
||||||
|
|
||||||
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."""
|
"""Set new target hvac mode."""
|
||||||
await self.async_set_heating_mode(HVAC_MODE_TO_OVERKIZ[hvac_mode])
|
await self.async_set_heating_mode(HVAC_MODE_TO_OVERKIZ[hvac_mode])
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ from homeassistant.const import UnitOfTemperature
|
|||||||
|
|
||||||
from ..entity import OverkizEntity
|
from ..entity import OverkizEntity
|
||||||
|
|
||||||
OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
|
OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
|
||||||
OverkizCommandParam.HEATING: HVACMode.HEAT,
|
OverkizCommandParam.HEATING: HVACMode.HEAT,
|
||||||
OverkizCommandParam.DRYING: HVACMode.DRY,
|
OverkizCommandParam.DRYING: HVACMode.DRY,
|
||||||
OverkizCommandParam.COOLING: HVACMode.COOL,
|
OverkizCommandParam.COOLING: HVACMode.COOL,
|
||||||
@ -25,7 +25,7 @@ class AtlanticPassAPCZoneControl(OverkizEntity, ClimateEntity):
|
|||||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> str:
|
def hvac_mode(self) -> HVACMode:
|
||||||
"""Return hvac operation ie. heat, cool mode."""
|
"""Return hvac operation ie. heat, cool mode."""
|
||||||
return OVERKIZ_TO_HVAC_MODE[
|
return OVERKIZ_TO_HVAC_MODE[
|
||||||
cast(
|
cast(
|
||||||
@ -33,7 +33,7 @@ class AtlanticPassAPCZoneControl(OverkizEntity, ClimateEntity):
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
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."""
|
"""Set new target hvac mode."""
|
||||||
await self.executor.async_execute_command(
|
await self.executor.async_execute_command(
|
||||||
OverkizCommand.SET_PASS_APC_OPERATING_MODE, HVAC_MODE_TO_OVERKIZ[hvac_mode]
|
OverkizCommand.SET_PASS_APC_OPERATING_MODE, HVAC_MODE_TO_OVERKIZ[hvac_mode]
|
||||||
|
@ -74,7 +74,7 @@ class SomfyThermostat(OverkizEntity, ClimateEntity):
|
|||||||
)
|
)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hvac_mode(self) -> str:
|
def hvac_mode(self) -> HVACMode:
|
||||||
"""Return hvac operation ie. heat, cool mode."""
|
"""Return hvac operation ie. heat, cool mode."""
|
||||||
return OVERKIZ_TO_HVAC_MODES[
|
return OVERKIZ_TO_HVAC_MODES[
|
||||||
cast(
|
cast(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user