Use _attr_supported_features in nest climate (#82217)

This commit is contained in:
epenet 2022-11-17 13:03:50 +01:00 committed by GitHub
parent ae181a47fd
commit 44b28d67f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,7 +97,7 @@ class NestThermostat(ClimateEntity):
self._fan_modes = [FAN_ON, FAN_AUTO] self._fan_modes = [FAN_ON, FAN_AUTO]
# Set the default supported features # Set the default supported features
self._support_flags = ( self._attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.PRESET_MODE
) )
@ -106,7 +106,9 @@ class NestThermostat(ClimateEntity):
if self.device.can_heat and self.device.can_cool: if self.device.can_heat and self.device.can_cool:
self._operation_list.append(HVACMode.AUTO) self._operation_list.append(HVACMode.AUTO)
self._support_flags |= ClimateEntityFeature.TARGET_TEMPERATURE_RANGE self._attr_supported_features |= (
ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
)
# Add supported nest thermostat features # Add supported nest thermostat features
if self.device.can_heat: if self.device.can_heat:
@ -120,7 +122,7 @@ class NestThermostat(ClimateEntity):
# feature of device # feature of device
self._has_fan = self.device.has_fan self._has_fan = self.device.has_fan
if self._has_fan: if self._has_fan:
self._support_flags |= ClimateEntityFeature.FAN_MODE self._attr_supported_features |= ClimateEntityFeature.FAN_MODE
# data attributes # data attributes
self._away = None self._away = None
@ -150,11 +152,6 @@ class NestThermostat(ClimateEntity):
async_dispatcher_connect(self.hass, SIGNAL_NEST_UPDATE, async_update_state) async_dispatcher_connect(self.hass, SIGNAL_NEST_UPDATE, async_update_state)
) )
@property
def supported_features(self):
"""Return the list of supported features."""
return self._support_flags
@property @property
def unique_id(self): def unique_id(self):
"""Return unique ID for this device.""" """Return unique ID for this device."""