Add migrated climate feature flag to switchbee (#109458)

pull/109883/head
G Johansson 2024-02-04 08:59:34 -05:00 committed by Franck Nijhof
parent ac2e05b5c0
commit 97446a5af3
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 9 additions and 3 deletions

View File

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