mirror of
https://github.com/home-assistant/core.git
synced 2026-02-15 07:36:16 +00:00
Mark preset_mode type hints as compulsory in climate/fan platforms (#161043)
This commit is contained in:
@@ -192,7 +192,7 @@ class MaxCubeClimate(ClimateEntity):
|
||||
self._set_target(None, temp)
|
||||
|
||||
@property
|
||||
def preset_mode(self):
|
||||
def preset_mode(self) -> str:
|
||||
"""Return the current preset mode."""
|
||||
if self._device.mode == MAX_DEVICE_MODE_MANUAL:
|
||||
if self._device.target_temperature == self._device.comfort_temperature:
|
||||
|
||||
@@ -225,7 +225,7 @@ class NexiaZone(NexiaThermostatZoneEntity, ClimateEntity):
|
||||
self._signal_thermostat_update()
|
||||
|
||||
@property
|
||||
def preset_mode(self):
|
||||
def preset_mode(self) -> str | None:
|
||||
"""Preset that is active."""
|
||||
return self._zone.get_preset()
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
|
||||
return nuheat_to_fahrenheit(self._target_temperature)
|
||||
|
||||
@property
|
||||
def preset_mode(self):
|
||||
def preset_mode(self) -> str:
|
||||
"""Return current preset mode."""
|
||||
return SCHEDULE_MODE_TO_PRESET_MODE_MAP.get(self._schedule_mode, PRESET_RUN)
|
||||
|
||||
|
||||
@@ -282,8 +282,10 @@ class ViCareClimate(ViCareEntity, ClimateEntity):
|
||||
self._attr_target_temperature = temp
|
||||
|
||||
@property
|
||||
def preset_mode(self):
|
||||
def preset_mode(self) -> str | None:
|
||||
"""Return the current preset mode, e.g., home, away, temp."""
|
||||
if self._current_program is None:
|
||||
return None
|
||||
return HeatingProgram.to_ha_preset(self._current_program)
|
||||
|
||||
def set_preset_mode(self, preset_mode: str) -> None:
|
||||
|
||||
@@ -1225,6 +1225,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||
TypeHintMatch(
|
||||
function_name="preset_mode",
|
||||
return_type=["str", None],
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="preset_modes",
|
||||
@@ -1602,6 +1603,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||
TypeHintMatch(
|
||||
function_name="preset_mode",
|
||||
return_type=["str", None],
|
||||
mandatory=True,
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="preset_modes",
|
||||
|
||||
Reference in New Issue
Block a user