Use EntityFeature enum in components (h**) (#69403)

This commit is contained in:
epenet 2022-04-06 11:59:23 +02:00 committed by GitHub
parent 38cfa83e23
commit 999e2f3bf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 118 additions and 188 deletions

View file

@ -4,7 +4,7 @@ import logging
from pyaehw4a1.aehw4a1 import AehW4a1
import pyaehw4a1.exceptions
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
from homeassistant.components.climate.const import (
FAN_AUTO,
FAN_HIGH,
@ -19,10 +19,6 @@ from homeassistant.components.climate.const import (
PRESET_ECO,
PRESET_NONE,
PRESET_SLEEP,
SUPPORT_FAN_MODE,
SUPPORT_PRESET_MODE,
SUPPORT_SWING_MODE,
SUPPORT_TARGET_TEMPERATURE,
SWING_BOTH,
SWING_HORIZONTAL,
SWING_OFF,
@ -40,13 +36,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from . import CONF_IP_ADDRESS, DOMAIN
SUPPORT_FLAGS = (
SUPPORT_TARGET_TEMPERATURE
| SUPPORT_FAN_MODE
| SUPPORT_SWING_MODE
| SUPPORT_PRESET_MODE
)
MIN_TEMP_C = 16
MAX_TEMP_C = 32
@ -153,6 +142,13 @@ async def async_setup_entry(
class ClimateAehW4a1(ClimateEntity):
"""Representation of a Hisense AEH-W4A1 module for climate device."""
_attr_supported_features = (
ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.FAN_MODE
| ClimateEntityFeature.SWING_MODE
| ClimateEntityFeature.PRESET_MODE
)
def __init__(self, device):
"""Initialize the climate device."""
self._unique_id = device
@ -319,11 +315,6 @@ class ClimateAehW4a1(ClimateEntity):
"""Return the supported step of target temperature."""
return 1
@property
def supported_features(self):
"""Return the list of supported features."""
return SUPPORT_FLAGS
async def async_set_temperature(self, **kwargs):
"""Set new target temperatures."""
if self._on != "1":