Add migrated climate feature flag to switchbee (#109458)

pull/106803/head
G Johansson 2024-02-04 08:59:34 -05:00 committed by GitHub
parent 9831da34ce
commit c732668d6e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 3 deletions

View File

@ -1,4 +1,5 @@
"""Support for SwitchBee climate."""
from __future__ import annotations
from typing import Any
@ -87,11 +88,9 @@ async def async_setup_entry(
class SwitchBeeClimateEntity(SwitchBeeDeviceEntity[SwitchBeeThermostat], ClimateEntity):
"""Representation of a SwitchBee climate."""
_attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
)
_attr_fan_modes = SUPPORTED_FAN_MODES
_attr_target_temperature_step = 1
_enable_turn_on_off_backwards_compatibility = False
def __init__(
self,
@ -106,6 +105,13 @@ class SwitchBeeClimateEntity(SwitchBeeDeviceEntity[SwitchBeeThermostat], Climate
self._attr_temperature_unit = HVAC_UNIT_SB_TO_HASS[device.temperature_unit]
self._attr_hvac_modes = [HVAC_MODE_SB_TO_HASS[mode] for mode in device.modes]
self._attr_hvac_modes.append(HVACMode.OFF)
self._attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
)
if len(self.hvac_modes) > 1:
self._attr_supported_features |= (
ClimateEntityFeature.TURN_OFF | ClimateEntityFeature.TURN_ON
)
self._update_attrs_from_coordinator()
@callback