diff --git a/homeassistant/components/airtouch4/climate.py b/homeassistant/components/airtouch4/climate.py index 6d393ed0c99..3cb6a78128b 100644 --- a/homeassistant/components/airtouch4/climate.py +++ b/homeassistant/components/airtouch4/climate.py @@ -142,7 +142,7 @@ class AirtouchAC(CoordinatorEntity, ClimateEntity): return AT_TO_HA_STATE[self._airtouch.acs[self._ac_number].AcMode] @property - def hvac_modes(self): + def hvac_modes(self) -> list[HVACMode]: """Return the list of available operation modes.""" airtouch_modes = self._airtouch.GetSupportedCoolingModesForAc(self._ac_number) modes = [AT_TO_HA_STATE[mode] for mode in airtouch_modes] @@ -226,12 +226,12 @@ class AirtouchGroup(CoordinatorEntity, ClimateEntity): return super()._handle_coordinator_update() @property - def min_temp(self): + def min_temp(self) -> float: """Return Minimum Temperature for AC of this group.""" return self._airtouch.acs[self._unit.BelongsToAc].MinSetpoint @property - def max_temp(self): + def max_temp(self) -> float: """Return Max Temperature for AC of this group.""" return self._airtouch.acs[self._unit.BelongsToAc].MaxSetpoint diff --git a/homeassistant/components/econet/climate.py b/homeassistant/components/econet/climate.py index 69ca3a827ec..c5d45d75dcf 100644 --- a/homeassistant/components/econet/climate.py +++ b/homeassistant/components/econet/climate.py @@ -206,12 +206,12 @@ class EcoNetThermostat(EcoNetEntity[Thermostat], ClimateEntity): self._econet.set_fan_mode(HA_FAN_STATE_TO_ECONET[fan_mode]) @property - def min_temp(self): + def min_temp(self) -> float: """Return the minimum temperature.""" return self._econet.set_point_limits[0] @property - def max_temp(self): + def max_temp(self) -> float: """Return the maximum temperature.""" return self._econet.set_point_limits[1] diff --git a/homeassistant/components/ephember/climate.py b/homeassistant/components/ephember/climate.py index efdd106b34b..8e72457f4a7 100644 --- a/homeassistant/components/ephember/climate.py +++ b/homeassistant/components/ephember/climate.py @@ -159,7 +159,7 @@ class EphEmberThermostat(ClimateEntity): self._ember.set_zone_target_temperature(self._zone["zoneid"], temperature) @property - def min_temp(self): + def min_temp(self) -> float: """Return the minimum temperature.""" # Hot water temp doesn't support being changed if self._hot_water: @@ -168,7 +168,7 @@ class EphEmberThermostat(ClimateEntity): return 5.0 @property - def max_temp(self): + def max_temp(self) -> float: """Return the maximum temperature.""" if self._hot_water: return zone_target_temperature(self._zone) diff --git a/homeassistant/components/maxcube/climate.py b/homeassistant/components/maxcube/climate.py index 296da4f0ab4..69a0eb8a553 100644 --- a/homeassistant/components/maxcube/climate.py +++ b/homeassistant/components/maxcube/climate.py @@ -93,7 +93,7 @@ class MaxCubeClimate(ClimateEntity): ] @property - def min_temp(self): + def min_temp(self) -> float: """Return the minimum temperature.""" temp = self._device.min_temperature or MIN_TEMPERATURE # OFF_TEMPERATURE (always off) a is valid temperature to maxcube but not to Home Assistant. @@ -101,7 +101,7 @@ class MaxCubeClimate(ClimateEntity): return max(temp, MIN_TEMPERATURE) @property - def max_temp(self): + def max_temp(self) -> float: """Return the maximum temperature.""" return self._device.max_temperature or MAX_TEMPERATURE diff --git a/homeassistant/components/nuheat/climate.py b/homeassistant/components/nuheat/climate.py index 376a07ddb7b..85e24c116f9 100644 --- a/homeassistant/components/nuheat/climate.py +++ b/homeassistant/components/nuheat/climate.py @@ -130,7 +130,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity): return HVACAction.HEATING if self._thermostat.heating else HVACAction.IDLE @property - def min_temp(self): + def min_temp(self) -> float: """Return the minimum supported temperature for the thermostat.""" if self._temperature_unit == "C": return self._thermostat.min_celsius @@ -138,7 +138,7 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity): return self._thermostat.min_fahrenheit @property - def max_temp(self): + def max_temp(self) -> float: """Return the maximum supported temperature for the thermostat.""" if self._temperature_unit == "C": return self._thermostat.max_celsius diff --git a/homeassistant/components/schluter/climate.py b/homeassistant/components/schluter/climate.py index 7db15d3923c..581140d9406 100644 --- a/homeassistant/components/schluter/climate.py +++ b/homeassistant/components/schluter/climate.py @@ -118,12 +118,12 @@ class SchluterThermostat(CoordinatorEntity, ClimateEntity): return self.coordinator.data[self._serial_number].set_point_temp @property - def min_temp(self): + def min_temp(self) -> float: """Identify min_temp in Schluter API.""" return self.coordinator.data[self._serial_number].min_temp @property - def max_temp(self): + def max_temp(self) -> float: """Identify max_temp in Schluter API.""" return self.coordinator.data[self._serial_number].max_temp diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index deccb08c5aa..547f3a14c93 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -293,7 +293,7 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): ) self._send_command(commands) - def set_preset_mode(self, preset_mode): + def set_preset_mode(self, preset_mode: str) -> None: """Set new target preset mode.""" commands = [{"code": DPCode.MODE, "value": preset_mode}] self._send_command(commands) diff --git a/homeassistant/components/zhong_hong/climate.py b/homeassistant/components/zhong_hong/climate.py index af3287d3068..217636edbd5 100644 --- a/homeassistant/components/zhong_hong/climate.py +++ b/homeassistant/components/zhong_hong/climate.py @@ -216,12 +216,12 @@ class ZhongHongClimate(ClimateEntity): return self._device.fan_list @property - def min_temp(self): + def min_temp(self) -> float: """Return the minimum temperature.""" return self._device.min_temp @property - def max_temp(self): + def max_temp(self) -> float: """Return the maximum temperature.""" return self._device.max_temp diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index bbc0c4b7972..e92429d1620 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1171,10 +1171,12 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="precision", return_type="float", + mandatory=True, ), TypeHintMatch( function_name="temperature_unit", return_type="str", + mandatory=True, ), TypeHintMatch( function_name="current_humidity", @@ -1191,6 +1193,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { TypeHintMatch( function_name="hvac_modes", return_type="list[HVACMode]", + mandatory=True, ), TypeHintMatch( function_name="hvac_action", @@ -1249,6 +1252,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { kwargs_type="Any", return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="set_humidity", @@ -1257,6 +1261,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { }, return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="set_fan_mode", @@ -1265,6 +1270,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { }, return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="set_hvac_mode", @@ -1273,6 +1279,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { }, return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="set_swing_mode", @@ -1281,6 +1288,7 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { }, return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="set_preset_mode", @@ -1289,46 +1297,56 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { }, return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="turn_aux_heat_on", return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="turn_aux_heat_off", return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="turn_on", return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="turn_off", return_type="None", has_async_counterpart=True, + mandatory=True, ), TypeHintMatch( function_name="supported_features", return_type="ClimateEntityFeature", + mandatory=True, ), TypeHintMatch( function_name="min_temp", return_type="float", + mandatory=True, ), TypeHintMatch( function_name="max_temp", return_type="float", + mandatory=True, ), TypeHintMatch( function_name="min_humidity", return_type="float", + mandatory=True, ), TypeHintMatch( function_name="max_humidity", return_type="float", + mandatory=True, ), ], ),