Add climate feature flags to spider (#109456)

This commit is contained in:
G Johansson 2024-02-04 05:39:04 -05:00 committed by GitHub
parent 89d77ee8ab
commit 37f3fcbdaf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 9 deletions

View File

@ -43,6 +43,7 @@ class SpiderThermostat(ClimateEntity):
_attr_has_entity_name = True
_attr_name = None
_attr_temperature_unit = UnitOfTemperature.CELSIUS
_enable_turn_on_off_backwards_compatibility = False
def __init__(self, api, thermostat):
"""Initialize the thermostat."""
@ -53,6 +54,13 @@ class SpiderThermostat(ClimateEntity):
for operation_value in thermostat.operation_values:
if operation_value in SPIDER_STATE_TO_HA:
self.support_hvac.append(SPIDER_STATE_TO_HA[operation_value])
self._attr_supported_features |= ClimateEntityFeature.TARGET_TEMPERATURE
if len(self.hvac_modes) > 1 and HVACMode.OFF in self.hvac_modes:
self._attr_supported_features |= (
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
)
if thermostat.has_fan_mode:
self._attr_supported_features |= ClimateEntityFeature.FAN_MODE
@property
def device_info(self) -> DeviceInfo:
@ -65,15 +73,6 @@ class SpiderThermostat(ClimateEntity):
name=self.thermostat.name,
)
@property
def supported_features(self) -> ClimateEntityFeature:
"""Return the list of supported features."""
if self.thermostat.has_fan_mode:
return (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
)
return ClimateEntityFeature.TARGET_TEMPERATURE
@property
def unique_id(self):
"""Return the id of the thermostat, if any."""