diff --git a/homeassistant/components/atag/water_heater.py b/homeassistant/components/atag/water_heater.py index 009f84a72ef..0b41373356d 100644 --- a/homeassistant/components/atag/water_heater.py +++ b/homeassistant/components/atag/water_heater.py @@ -30,7 +30,6 @@ class AtagWaterHeater(AtagEntity, WaterHeaterEntity): """Representation of an ATAG water heater.""" _attr_operation_list = OPERATION_LIST - _attr_supported_features = 0 _attr_temperature_unit = TEMP_CELSIUS @property diff --git a/homeassistant/components/econet/water_heater.py b/homeassistant/components/econet/water_heater.py index 165dc49e205..c94afd8b5d7 100644 --- a/homeassistant/components/econet/water_heater.py +++ b/homeassistant/components/econet/water_heater.py @@ -106,7 +106,7 @@ class EcoNetWaterHeater(EcoNetEntity, WaterHeaterEntity): return op_list @property - def supported_features(self): + def supported_features(self) -> WaterHeaterEntityFeature: """Return the list of supported features.""" if self.water_heater.modes: if self.water_heater.supports_away: diff --git a/homeassistant/components/incomfort/water_heater.py b/homeassistant/components/incomfort/water_heater.py index 733e7d8adc2..fb16cc48f8b 100644 --- a/homeassistant/components/incomfort/water_heater.py +++ b/homeassistant/components/incomfort/water_heater.py @@ -88,11 +88,6 @@ class IncomfortWaterHeater(IncomfortEntity, WaterHeaterEntity): """Return the unit of measurement.""" return TEMP_CELSIUS - @property - def supported_features(self) -> int: - """Return the list of supported features.""" - return 0 - @property def current_operation(self) -> str: """Return the current operation mode.""" diff --git a/homeassistant/components/water_heater/__init__.py b/homeassistant/components/water_heater/__init__.py index ed12a1a6cf9..187c643638b 100644 --- a/homeassistant/components/water_heater/__init__.py +++ b/homeassistant/components/water_heater/__init__.py @@ -167,7 +167,7 @@ class WaterHeaterEntity(Entity): _attr_operation_list: list[str] | None = None _attr_precision: float _attr_state: None = None - _attr_supported_features: int + _attr_supported_features: WaterHeaterEntityFeature | int = 0 _attr_target_temperature_high: float | None = None _attr_target_temperature_low: float | None = None _attr_target_temperature: float | None = None @@ -341,6 +341,11 @@ class WaterHeaterEntity(Entity): DEFAULT_MAX_TEMP, TEMP_FAHRENHEIT, self.temperature_unit ) + @property + def supported_features(self) -> WaterHeaterEntityFeature | int: + """Return the list of supported features.""" + return self._attr_supported_features + async def async_service_away_mode( entity: WaterHeaterEntity, service: ServiceCall diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index e454be1ee22..bbae733a536 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -2510,24 +2510,36 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { base_class="WaterHeaterEntity", matches=[ TypeHintMatch( - function_name="precision", + function_name="current_operation", + return_type=["str", None], + ), + TypeHintMatch( + function_name="current_temperature", + return_type=["float", None], + ), + TypeHintMatch( + function_name="is_away_mode_on", + return_type=["bool", None], + ), + TypeHintMatch( + function_name="max_temp", return_type="float", ), TypeHintMatch( - function_name="temperature_unit", - return_type="str", - ), - TypeHintMatch( - function_name="current_operation", - return_type=["str", None], + function_name="min_temp", + return_type="float", ), TypeHintMatch( function_name="operation_list", return_type=["list[str]", None], ), TypeHintMatch( - function_name="current_temperature", - return_type=["float", None], + function_name="precision", + return_type="float", + ), + TypeHintMatch( + function_name="supported_features", + return_type=["WaterHeaterEntityFeature", "int"], ), TypeHintMatch( function_name="target_temperature", @@ -2542,8 +2554,8 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { return_type=["float", None], ), TypeHintMatch( - function_name="is_away_mode_on", - return_type=["bool", None], + function_name="temperature_unit", + return_type="str", ), TypeHintMatch( function_name="set_temperature", @@ -2567,14 +2579,6 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { return_type=None, has_async_counterpart=True, ), - TypeHintMatch( - function_name="min_temp", - return_type="float", - ), - TypeHintMatch( - function_name="max_temp", - return_type="float", - ), ], ), ],