Fix HAVCMode typing in Overkiz (#94632)

This commit is contained in:
Franck Nijhof 2023-06-15 14:06:06 +02:00 committed by GitHub
parent 886dea59c3
commit 1d3a7512d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 12 deletions

View File

@ -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()}
# 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.OFF: HVACMode.OFF,
OverkizCommandParam.AUTO: HVACMode.AUTO,
@ -83,7 +83,7 @@ class AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint(
)
@property
def hvac_mode(self) -> str:
def hvac_mode(self) -> HVACMode:
"""Return hvac operation ie. heat, cool mode."""
states = self.device.states
if (state := states[OverkizState.CORE_OPERATING_MODE]) and state.value_as_str:

View File

@ -20,7 +20,7 @@ from ..entity import OverkizEntity
PRESET_DRYING = "drying"
OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
OverkizCommandParam.EXTERNAL: HVACMode.HEAT, # manu
OverkizCommandParam.INTERNAL: HVACMode.AUTO, # prog
OverkizCommandParam.STANDBY: HVACMode.OFF,
@ -62,7 +62,7 @@ class AtlanticElectricalTowelDryer(OverkizEntity, ClimateEntity):
self._attr_supported_features |= ClimateEntityFeature.PRESET_MODE
@property
def hvac_mode(self) -> str:
def hvac_mode(self) -> HVACMode:
"""Return hvac operation ie. heat, cool mode."""
if OverkizState.CORE_OPERATING_MODE in self.device.states:
return OVERKIZ_TO_HVAC_MODE[
@ -71,7 +71,7 @@ class AtlanticElectricalTowelDryer(OverkizEntity, ClimateEntity):
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."""
await self.executor.async_execute_command(
OverkizCommand.SET_TOWEL_DRYER_OPERATING_MODE,

View File

@ -21,7 +21,7 @@ from ..const import DOMAIN
from ..coordinator import OverkizDataUpdateCoordinator
from ..entity import OverkizEntity
OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
OverkizCommandParam.AUTO: HVACMode.AUTO,
OverkizCommandParam.ECO: HVACMode.AUTO,
OverkizCommandParam.MANU: HVACMode.HEAT,
@ -101,7 +101,7 @@ class AtlanticPassAPCHeatingZone(OverkizEntity, ClimateEntity):
return None
@property
def hvac_mode(self) -> str:
def hvac_mode(self) -> HVACMode:
"""Return hvac operation ie. heat, cool mode."""
return OVERKIZ_TO_HVAC_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
)
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.async_set_heating_mode(HVAC_MODE_TO_OVERKIZ[hvac_mode])

View File

@ -8,7 +8,7 @@ from homeassistant.const import UnitOfTemperature
from ..entity import OverkizEntity
OVERKIZ_TO_HVAC_MODE: dict[str, str] = {
OVERKIZ_TO_HVAC_MODE: dict[str, HVACMode] = {
OverkizCommandParam.HEATING: HVACMode.HEAT,
OverkizCommandParam.DRYING: HVACMode.DRY,
OverkizCommandParam.COOLING: HVACMode.COOL,
@ -25,7 +25,7 @@ class AtlanticPassAPCZoneControl(OverkizEntity, ClimateEntity):
_attr_temperature_unit = UnitOfTemperature.CELSIUS
@property
def hvac_mode(self) -> str:
def hvac_mode(self) -> HVACMode:
"""Return hvac operation ie. heat, cool mode."""
return OVERKIZ_TO_HVAC_MODE[
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."""
await self.executor.async_execute_command(
OverkizCommand.SET_PASS_APC_OPERATING_MODE, HVAC_MODE_TO_OVERKIZ[hvac_mode]

View File

@ -74,7 +74,7 @@ class SomfyThermostat(OverkizEntity, ClimateEntity):
)
@property
def hvac_mode(self) -> str:
def hvac_mode(self) -> HVACMode:
"""Return hvac operation ie. heat, cool mode."""
return OVERKIZ_TO_HVAC_MODES[
cast(