diff --git a/homeassistant/components/climate/__init__.py b/homeassistant/components/climate/__init__.py index 1cea229a306..68338819421 100644 --- a/homeassistant/components/climate/__init__.py +++ b/homeassistant/components/climate/__init__.py @@ -225,7 +225,7 @@ class ClimateEntity(Entity): _attr_precision: float _attr_preset_mode: str | None _attr_preset_modes: list[str] | None - _attr_supported_features: ClimateEntityFeature | int = 0 + _attr_supported_features: ClimateEntityFeature = ClimateEntityFeature(0) _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) -> ClimateEntityFeature | int: + def supported_features(self) -> ClimateEntityFeature: """Return the list of supported features.""" return self._attr_supported_features diff --git a/homeassistant/components/demo/climate.py b/homeassistant/components/demo/climate.py index 52616d4cf47..00e049c6034 100644 --- a/homeassistant/components/demo/climate.py +++ b/homeassistant/components/demo/climate.py @@ -20,7 +20,7 @@ from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType from . import DOMAIN -SUPPORT_FLAGS = 0 +SUPPORT_FLAGS = ClimateEntityFeature(0) async def async_setup_platform( diff --git a/homeassistant/components/esphome/climate.py b/homeassistant/components/esphome/climate.py index e27d1d47bca..352068aaa57 100644 --- a/homeassistant/components/esphome/climate.py +++ b/homeassistant/components/esphome/climate.py @@ -197,9 +197,9 @@ class EsphomeClimateEntity(EsphomeEntity[ClimateInfo, ClimateState], ClimateEnti return self._static_info.visual_max_temperature @property - def supported_features(self) -> ClimateEntityFeature | int: + def supported_features(self) -> ClimateEntityFeature: """Return the list of supported features.""" - features = 0 + features = ClimateEntityFeature(0) if self._static_info.supports_two_point_target_temperature: features |= ClimateEntityFeature.TARGET_TEMPERATURE_RANGE else: diff --git a/homeassistant/components/homekit_controller/climate.py b/homeassistant/components/homekit_controller/climate.py index 3838c3a862e..2dc998200a4 100644 --- a/homeassistant/components/homekit_controller/climate.py +++ b/homeassistant/components/homekit_controller/climate.py @@ -148,9 +148,9 @@ class HomeKitBaseClimateEntity(HomeKitEntity, ClimateEntity): ) @property - def supported_features(self) -> ClimateEntityFeature | int: + def supported_features(self) -> ClimateEntityFeature: """Return the list of supported features.""" - features = 0 + features = ClimateEntityFeature(0) if self.service.has(CharacteristicsTypes.FAN_STATE_TARGET): features |= ClimateEntityFeature.FAN_MODE @@ -368,7 +368,7 @@ class HomeKitHeaterCoolerEntity(HomeKitBaseClimateEntity): ) @property - def supported_features(self) -> ClimateEntityFeature | int: + def supported_features(self) -> ClimateEntityFeature: """Return the list of supported features.""" features = super().supported_features @@ -602,7 +602,7 @@ class HomeKitClimateEntity(HomeKitBaseClimateEntity): return [MODE_HOMEKIT_TO_HASS[mode] for mode in valid_values] @property - def supported_features(self) -> ClimateEntityFeature | int: + def supported_features(self) -> ClimateEntityFeature: """Return the list of supported features.""" features = super().supported_features diff --git a/homeassistant/components/izone/climate.py b/homeassistant/components/izone/climate.py index a8dc90ad88c..c94ccada5b3 100644 --- a/homeassistant/components/izone/climate.py +++ b/homeassistant/components/izone/climate.py @@ -517,7 +517,7 @@ class ZoneDevice(ClimateEntity): @property @_return_on_connection_error(0) - def supported_features(self) -> ClimateEntityFeature | int: + def supported_features(self) -> ClimateEntityFeature: """Return the list of supported features.""" if self._zone.mode == Zone.Mode.AUTO: return self._attr_supported_features diff --git a/homeassistant/components/mqtt/climate.py b/homeassistant/components/mqtt/climate.py index 1c3e48efd74..0d3313a4475 100644 --- a/homeassistant/components/mqtt/climate.py +++ b/homeassistant/components/mqtt/climate.py @@ -456,7 +456,7 @@ class MqttClimate(MqttEntity, ClimateEntity): config.get(key), entity=self ).async_render - support: ClimateEntityFeature | int = 0 + support = ClimateEntityFeature(0) if (self._topic[CONF_TEMP_STATE_TOPIC] is not None) or ( self._topic[CONF_TEMP_COMMAND_TOPIC] is not None ): diff --git a/homeassistant/components/mysensors/climate.py b/homeassistant/components/mysensors/climate.py index abaa74ab2fa..38077768f2e 100644 --- a/homeassistant/components/mysensors/climate.py +++ b/homeassistant/components/mysensors/climate.py @@ -77,9 +77,9 @@ class MySensorsHVAC(mysensors.device.MySensorsEntity, ClimateEntity): _attr_hvac_modes = OPERATION_LIST @property - def supported_features(self) -> ClimateEntityFeature | int: + def supported_features(self) -> ClimateEntityFeature: """Return the list of supported features.""" - features = 0 + features = ClimateEntityFeature(0) set_req = self.gateway.const.SetReq if set_req.V_HVAC_SPEED in self._values: features = features | ClimateEntityFeature.FAN_MODE diff --git a/homeassistant/components/nest/climate_sdm.py b/homeassistant/components/nest/climate_sdm.py index bed44045c11..4a453c5fd38 100644 --- a/homeassistant/components/nest/climate_sdm.py +++ b/homeassistant/components/nest/climate_sdm.py @@ -104,7 +104,6 @@ class ThermostatEntity(ClimateEntity): """Initialize ThermostatEntity.""" self._device = device self._device_info = NestDeviceInfo(device) - self._attr_supported_features = 0 @property def unique_id(self) -> str | None: @@ -266,9 +265,9 @@ class ThermostatEntity(ClimateEntity): return FAN_INV_MODES return [] - def _get_supported_features(self) -> int: + def _get_supported_features(self) -> ClimateEntityFeature: """Compute the bitmap of supported features from the current state.""" - features = 0 + features = ClimateEntityFeature(0) if HVACMode.HEAT_COOL in self.hvac_modes: features |= ClimateEntityFeature.TARGET_TEMPERATURE_RANGE if HVACMode.HEAT in self.hvac_modes or HVACMode.COOL in self.hvac_modes: diff --git a/homeassistant/components/sensibo/climate.py b/homeassistant/components/sensibo/climate.py index 4c11d5e781b..b1980b5e595 100644 --- a/homeassistant/components/sensibo/climate.py +++ b/homeassistant/components/sensibo/climate.py @@ -176,9 +176,9 @@ class SensiboClimate(SensiboDeviceBaseEntity, ClimateEntity): self._attr_supported_features = self.get_features() self._attr_precision = PRECISION_TENTHS - def get_features(self) -> ClimateEntityFeature | int: + def get_features(self) -> ClimateEntityFeature: """Get supported features.""" - features = 0 + features = ClimateEntityFeature(0) for key in self.device_data.full_features: if key in FIELD_TO_FLAG: features |= FIELD_TO_FLAG[key] diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index f03f9f11186..78c21747948 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1055,7 +1055,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ), TypeHintMatch( function_name="supported_features", - return_type=["ClimateEntityFeature", "int"], + return_type="ClimateEntityFeature", ), TypeHintMatch( function_name="min_temp",