Use EntityFeature enum in components (f**) (#69389)

This commit is contained in:
epenet 2022-04-06 10:55:25 +02:00 committed by GitHub
parent 1fe5b1e68a
commit 9ab9fcfc56
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 61 additions and 104 deletions

View file

@ -5,12 +5,12 @@ import logging
import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_COOL,
SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE,
from homeassistant.components.climate import (
PLATFORM_SCHEMA,
ClimateEntity,
ClimateEntityFeature,
)
from homeassistant.components.climate.const import HVAC_MODE_COOL
from homeassistant.components.modbus import get_hub
from homeassistant.components.modbus.const import (
CALL_TYPE_REGISTER_HOLDING,
@ -42,8 +42,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
_LOGGER = logging.getLogger(__name__)
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE
async def async_setup_platform(
hass: HomeAssistant,
@ -61,6 +59,10 @@ async def async_setup_platform(
class Flexit(ClimateEntity):
"""Representation of a Flexit AC unit."""
_attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE | ClimateEntityFeature.FAN_MODE
)
def __init__(
self, hub: ModbusHub, modbus_slave: int | None, name: str | None
) -> None:
@ -83,11 +85,6 @@ class Flexit(ClimateEntity):
self._alarm = False
self._outdoor_air_temp = None
@property
def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS
async def async_update(self):
"""Update unit attributes."""
self._target_temperature = await self._async_read_temp_from_register(