Improve tado typing (#140505)

This commit is contained in:
Marc Mueller 2025-03-13 16:48:04 +01:00 committed by GitHub
parent c92ee120b6
commit 473a5559cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -157,8 +157,8 @@ async def create_climate_entity(
TADO_TO_HA_HVAC_MODE_MAP[CONST_MODE_OFF],
TADO_TO_HA_HVAC_MODE_MAP[CONST_MODE_SMART_SCHEDULE],
]
supported_fan_modes = None
supported_swing_modes = None
supported_fan_modes: list[str] | None = None
supported_swing_modes: list[str] | None = None
heat_temperatures = None
cool_temperatures = None

View File

@ -53,13 +53,13 @@ def decide_duration(
return duration
def generate_supported_fanmodes(tado_to_ha_mapping: dict[str, str], options: list[str]):
def generate_supported_fanmodes(
tado_to_ha_mapping: dict[str, str], options: list[str]
) -> list[str] | None:
"""Return correct list of fan modes or None."""
supported_fanmodes = [
tado_to_ha_mapping.get(option)
for option in options
if tado_to_ha_mapping.get(option) is not None
val for option in options if (val := tado_to_ha_mapping.get(option)) is not None
]
if not supported_fanmodes:
return None