Adjust type hints for ClimateEntityFeature (#82206)
This commit is contained in:
parent
4e11246ba5
commit
39ac2c1101
10 changed files with 13 additions and 15 deletions
|
@ -225,7 +225,7 @@ class ClimateEntity(Entity):
|
|||
_attr_precision: float
|
||||
_attr_preset_mode: str | None
|
||||
_attr_preset_modes: list[str] | None
|
||||
_attr_supported_features: int
|
||||
_attr_supported_features: ClimateEntityFeature | int
|
||||
_attr_swing_mode: str | None
|
||||
_attr_swing_modes: list[str] | None
|
||||
_attr_target_humidity: int | None = None
|
||||
|
@ -552,7 +552,7 @@ class ClimateEntity(Entity):
|
|||
await self.async_set_hvac_mode(HVACMode.OFF)
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> ClimateEntityFeature | int:
|
||||
"""Return the list of supported features."""
|
||||
return self._attr_supported_features
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ class Thermostat(ClimateEntity):
|
|||
return self.thermostat["runtime"]["connected"]
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> ClimateEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
if self.has_humidifier_control:
|
||||
return SUPPORT_FLAGS | ClimateEntityFeature.TARGET_HUMIDITY
|
||||
|
|
|
@ -81,7 +81,7 @@ class EcoNetThermostat(EcoNetEntity, ClimateEntity):
|
|||
self.op_list.append(ha_mode)
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> ClimateEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
if self._econet.supports_humidifier:
|
||||
return SUPPORT_FLAGS_THERMOSTAT | ClimateEntityFeature.TARGET_HUMIDITY
|
||||
|
|
|
@ -93,7 +93,7 @@ class ConditionerEntity(LookinCoordinatorEntity, ClimateEntity):
|
|||
|
||||
_attr_current_humidity: float | None = None # type: ignore[assignment]
|
||||
_attr_temperature_unit = TEMP_CELSIUS
|
||||
_attr_supported_features: int = (
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
| ClimateEntityFeature.FAN_MODE
|
||||
| ClimateEntityFeature.SWING_MODE
|
||||
|
|
|
@ -169,13 +169,11 @@ class LyricClimate(LyricDeviceEntity, ClimateEntity):
|
|||
self.entity_description = description
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> ClimateEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
if self.device.changeableValues.thermostatSetpointStatus:
|
||||
support_flags = SUPPORT_FLAGS_LCC
|
||||
else:
|
||||
support_flags = SUPPORT_FLAGS_TCC
|
||||
return support_flags
|
||||
return SUPPORT_FLAGS_LCC
|
||||
return SUPPORT_FLAGS_TCC
|
||||
|
||||
@property
|
||||
def temperature_unit(self) -> str:
|
||||
|
|
|
@ -109,7 +109,7 @@ class BlockSleepingClimate(
|
|||
_attr_icon = "mdi:thermostat"
|
||||
_attr_max_temp = SHTRV_01_TEMPERATURE_SETTINGS["max"]
|
||||
_attr_min_temp = SHTRV_01_TEMPERATURE_SETTINGS["min"]
|
||||
_attr_supported_features: int = (
|
||||
_attr_supported_features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
|
||||
)
|
||||
_attr_target_temperature_step = SHTRV_01_TEMPERATURE_SETTINGS["step"]
|
||||
|
|
|
@ -64,7 +64,7 @@ class SpiderThermostat(ClimateEntity):
|
|||
)
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> ClimateEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
if self.thermostat.has_fan_mode:
|
||||
return (
|
||||
|
|
|
@ -125,7 +125,7 @@ class VenstarThermostat(VenstarEntity, ClimateEntity):
|
|||
self._attr_name = self._client.name
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> ClimateEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
features = (
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE
|
||||
|
|
|
@ -277,7 +277,7 @@ class Thermostat(ZhaEntity, ClimateEntity):
|
|||
return self._presets
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
def supported_features(self) -> ClimateEntityFeature:
|
||||
"""Return the list of supported features."""
|
||||
features = self._supported_flags
|
||||
if HVACMode.HEAT_COOL in self.hvac_modes:
|
||||
|
|
|
@ -1055,7 +1055,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
|||
),
|
||||
TypeHintMatch(
|
||||
function_name="supported_features",
|
||||
return_type="int",
|
||||
return_type=["ClimateEntityFeature", "int"],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="min_temp",
|
||||
|
|
Loading…
Add table
Reference in a new issue