Mark climate methods and properties as mandatory in pylint plugin (#145280)

* Mark climate methods and properties as mandatory in pylint plugin

* One more
This commit is contained in:
epenet 2025-05-20 13:40:17 +02:00 committed by GitHub
parent 64d6101fb7
commit 258c91d483
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 34 additions and 16 deletions

View File

@ -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

View File

@ -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]

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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,
),
],
),