Use EntityFeature enum in components (i**) (#69409)

This commit is contained in:
epenet 2022-04-07 09:35:27 +02:00 committed by GitHub
parent 75eec850c1
commit e6d8aa34fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 109 additions and 167 deletions

View file

@ -4,7 +4,7 @@ from __future__ import annotations
from pyinsteon.constants import ThermostatMode
from pyinsteon.operating_flag import CELSIUS
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate import ClimateEntity, ClimateEntityFeature
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
@ -19,10 +19,6 @@ from homeassistant.components.climate.const import (
HVAC_MODE_HEAT,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
SUPPORT_FAN_MODE,
SUPPORT_TARGET_HUMIDITY,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
@ -56,12 +52,6 @@ HVAC_MODES = {
3: HVAC_MODE_HEAT_COOL,
}
FAN_MODES = {4: HVAC_MODE_AUTO, 8: HVAC_MODE_FAN_ONLY}
SUPPORTED_FEATURES = (
SUPPORT_FAN_MODE
| SUPPORT_TARGET_HUMIDITY
| SUPPORT_TARGET_TEMPERATURE
| SUPPORT_TARGET_TEMPERATURE_RANGE
)
async def async_setup_entry(
@ -90,10 +80,12 @@ async def async_setup_entry(
class InsteonClimateEntity(InsteonEntity, ClimateEntity):
"""A Class for an Insteon climate entity."""
@property
def supported_features(self):
"""Return the supported features for this entity."""
return SUPPORTED_FEATURES
_attr_supported_features = (
ClimateEntityFeature.FAN_MODE
| ClimateEntityFeature.TARGET_HUMIDITY
| ClimateEntityFeature.TARGET_TEMPERATURE
| ClimateEntityFeature.TARGET_TEMPERATURE_RANGE
)
@property
def temperature_unit(self) -> str: