Use EntityFeature enum in components (z**) (#69471)

* Use EntityFeature enum in zha

* Use EntityFeature enum in zhong_hong

* Use EntityFeature enum in ziggo_mediabox_xl

* Use EntityFeature enum in zwave_js

* Use EntityFeature enum in zwave_me
This commit is contained in:
epenet 2022-04-07 08:21:31 +02:00 committed by GitHub
parent aaf64f728e
commit fbea950eb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 76 additions and 121 deletions

View file

@ -12,7 +12,7 @@ from random import randint
from zigpy.zcl.clusters.hvac import Fan as F, Thermostat as T
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE,
ATTR_TARGET_TEMP_HIGH,
@ -35,10 +35,6 @@ from homeassistant.components.climate.const import (
PRESET_COMFORT,
PRESET_ECO,
PRESET_NONE,
SUPPORT_FAN_MODE,
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
@ -155,7 +151,7 @@ class Thermostat(ZhaEntity, ClimateEntity):
self._thrm = self.cluster_channels.get(CHANNEL_THERMOSTAT)
self._preset = PRESET_NONE
self._presets = []
self._supported_flags = SUPPORT_TARGET_TEMPERATURE
self._supported_flags = ClimateEntityFeature.TARGET_TEMPERATURE
self._fan = self.cluster_channels.get(CHANNEL_FAN)
@property
@ -294,9 +290,9 @@ class Thermostat(ZhaEntity, ClimateEntity):
"""Return the list of supported features."""
features = self._supported_flags
if HVAC_MODE_HEAT_COOL in self.hvac_modes:
features |= SUPPORT_TARGET_TEMPERATURE_RANGE
features |= ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
if self._fan is not None:
self._supported_flags |= SUPPORT_FAN_MODE
self._supported_flags |= ClimateEntityFeature.FAN_MODE
return features
@property
@ -513,7 +509,7 @@ class SinopeTechnologiesThermostat(Thermostat):
"""Initialize ZHA Thermostat instance."""
super().__init__(unique_id, zha_device, channels, **kwargs)
self._presets = [PRESET_AWAY, PRESET_NONE]
self._supported_flags |= SUPPORT_PRESET_MODE
self._supported_flags |= ClimateEntityFeature.PRESET_MODE
self._manufacturer_ch = self.cluster_channels["sinope_manufacturer_specific"]
@property
@ -624,7 +620,7 @@ class MoesThermostat(Thermostat):
PRESET_BOOST,
PRESET_COMPLEX,
]
self._supported_flags |= SUPPORT_PRESET_MODE
self._supported_flags |= ClimateEntityFeature.PRESET_MODE
@property
def hvac_modes(self) -> tuple[str, ...]:
@ -705,7 +701,7 @@ class BecaThermostat(Thermostat):
PRESET_BOOST,
PRESET_TEMP_MANUAL,
]
self._supported_flags |= SUPPORT_PRESET_MODE
self._supported_flags |= ClimateEntityFeature.PRESET_MODE
@property
def hvac_modes(self) -> tuple[str, ...]:
@ -804,7 +800,7 @@ class ZONNSMARTThermostat(Thermostat):
PRESET_SCHEDULE,
self.PRESET_FROST,
]
self._supported_flags |= SUPPORT_PRESET_MODE
self._supported_flags |= ClimateEntityFeature.PRESET_MODE
async def async_attribute_updated(self, record):
"""Handle attribute update from device."""