mirror of
https://github.com/home-assistant/core.git
synced 2025-07-27 23:27:37 +00:00
Add climate feature flags to spider (#109456)
This commit is contained in:
parent
89d77ee8ab
commit
37f3fcbdaf
@ -43,6 +43,7 @@ class SpiderThermostat(ClimateEntity):
|
|||||||
_attr_has_entity_name = True
|
_attr_has_entity_name = True
|
||||||
_attr_name = None
|
_attr_name = None
|
||||||
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
_attr_temperature_unit = UnitOfTemperature.CELSIUS
|
||||||
|
_enable_turn_on_off_backwards_compatibility = False
|
||||||
|
|
||||||
def __init__(self, api, thermostat):
|
def __init__(self, api, thermostat):
|
||||||
"""Initialize the thermostat."""
|
"""Initialize the thermostat."""
|
||||||
@ -53,6 +54,13 @@ class SpiderThermostat(ClimateEntity):
|
|||||||
for operation_value in thermostat.operation_values:
|
for operation_value in thermostat.operation_values:
|
||||||
if operation_value in SPIDER_STATE_TO_HA:
|
if operation_value in SPIDER_STATE_TO_HA:
|
||||||
self.support_hvac.append(SPIDER_STATE_TO_HA[operation_value])
|
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
|
@property
|
||||||
def device_info(self) -> DeviceInfo:
|
def device_info(self) -> DeviceInfo:
|
||||||
@ -65,15 +73,6 @@ class SpiderThermostat(ClimateEntity):
|
|||||||
name=self.thermostat.name,
|
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
|
@property
|
||||||
def unique_id(self):
|
def unique_id(self):
|
||||||
"""Return the id of the thermostat, if any."""
|
"""Return the id of the thermostat, if any."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user