Use new DeviceClass and EntityCategory enums in advantage_air (#61255)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-08 21:19:10 +01:00 committed by GitHub
parent fd58c1eff5
commit 7215244c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 16 deletions

View File

@ -1,11 +1,10 @@
"""Binary Sensor platform for Advantage Air integration.""" """Binary Sensor platform for Advantage Air integration."""
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION, BinarySensorDeviceClass,
DEVICE_CLASS_PROBLEM,
BinarySensorEntity, BinarySensorEntity,
) )
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC from homeassistant.helpers.entity import EntityCategory
from .const import DOMAIN as ADVANTAGE_AIR_DOMAIN from .const import DOMAIN as ADVANTAGE_AIR_DOMAIN
from .entity import AdvantageAirEntity from .entity import AdvantageAirEntity
@ -34,8 +33,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class AdvantageAirZoneFilter(AdvantageAirEntity, BinarySensorEntity): class AdvantageAirZoneFilter(AdvantageAirEntity, BinarySensorEntity):
"""Advantage Air Filter.""" """Advantage Air Filter."""
_attr_device_class = DEVICE_CLASS_PROBLEM _attr_device_class = BinarySensorDeviceClass.PROBLEM
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC _attr_entity_category = EntityCategory.DIAGNOSTIC
def __init__(self, instance, ac_key): def __init__(self, instance, ac_key):
"""Initialize an Advantage Air Filter.""" """Initialize an Advantage Air Filter."""
@ -54,7 +53,7 @@ class AdvantageAirZoneFilter(AdvantageAirEntity, BinarySensorEntity):
class AdvantageAirZoneMotion(AdvantageAirEntity, BinarySensorEntity): class AdvantageAirZoneMotion(AdvantageAirEntity, BinarySensorEntity):
"""Advantage Air Zone Motion.""" """Advantage Air Zone Motion."""
_attr_device_class = DEVICE_CLASS_MOTION _attr_device_class = BinarySensorDeviceClass.MOTION
def __init__(self, instance, ac_key, zone_key): def __init__(self, instance, ac_key, zone_key):
"""Initialize an Advantage Air Zone Motion.""" """Initialize an Advantage Air Zone Motion."""
@ -74,7 +73,7 @@ class AdvantageAirZoneMyZone(AdvantageAirEntity, BinarySensorEntity):
"""Advantage Air Zone MyZone.""" """Advantage Air Zone MyZone."""
_attr_entity_registry_enabled_default = False _attr_entity_registry_enabled_default = False
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC _attr_entity_category = EntityCategory.DIAGNOSTIC
def __init__(self, instance, ac_key, zone_key): def __init__(self, instance, ac_key, zone_key):
"""Initialize an Advantage Air Zone MyZone.""" """Initialize an Advantage Air Zone MyZone."""

View File

@ -2,10 +2,10 @@
from homeassistant.components.cover import ( from homeassistant.components.cover import (
ATTR_POSITION, ATTR_POSITION,
DEVICE_CLASS_DAMPER,
SUPPORT_CLOSE, SUPPORT_CLOSE,
SUPPORT_OPEN, SUPPORT_OPEN,
SUPPORT_SET_POSITION, SUPPORT_SET_POSITION,
CoverDeviceClass,
CoverEntity, CoverEntity,
) )
@ -36,7 +36,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
class AdvantageAirZoneVent(AdvantageAirEntity, CoverEntity): class AdvantageAirZoneVent(AdvantageAirEntity, CoverEntity):
"""Advantage Air Cover Class.""" """Advantage Air Cover Class."""
_attr_device_class = DEVICE_CLASS_DAMPER _attr_device_class = CoverDeviceClass.DAMPER
_attr_supported_features = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION _attr_supported_features = SUPPORT_OPEN | SUPPORT_CLOSE | SUPPORT_SET_POSITION
def __init__(self, instance, ac_key, zone_key): def __init__(self, instance, ac_key, zone_key):

View File

@ -2,12 +2,13 @@
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
DEVICE_CLASS_TEMPERATURE, SensorDeviceClass,
SensorEntity, SensorEntity,
SensorStateClass, SensorStateClass,
) )
from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC, PERCENTAGE, TEMP_CELSIUS from homeassistant.const import PERCENTAGE, TEMP_CELSIUS
from homeassistant.helpers import config_validation as cv, entity_platform from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers.entity import EntityCategory
from .const import ADVANTAGE_AIR_STATE_OPEN, DOMAIN as ADVANTAGE_AIR_DOMAIN from .const import ADVANTAGE_AIR_STATE_OPEN, DOMAIN as ADVANTAGE_AIR_DOMAIN
from .entity import AdvantageAirEntity from .entity import AdvantageAirEntity
@ -50,7 +51,7 @@ class AdvantageAirTimeTo(AdvantageAirEntity, SensorEntity):
"""Representation of Advantage Air timer control.""" """Representation of Advantage Air timer control."""
_attr_native_unit_of_measurement = ADVANTAGE_AIR_SET_COUNTDOWN_UNIT _attr_native_unit_of_measurement = ADVANTAGE_AIR_SET_COUNTDOWN_UNIT
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC _attr_entity_category = EntityCategory.DIAGNOSTIC
def __init__(self, instance, ac_key, action): def __init__(self, instance, ac_key, action):
"""Initialize the Advantage Air timer control.""" """Initialize the Advantage Air timer control."""
@ -85,7 +86,7 @@ class AdvantageAirZoneVent(AdvantageAirEntity, SensorEntity):
_attr_native_unit_of_measurement = PERCENTAGE _attr_native_unit_of_measurement = PERCENTAGE
_attr_state_class = SensorStateClass.MEASUREMENT _attr_state_class = SensorStateClass.MEASUREMENT
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC _attr_entity_category = EntityCategory.DIAGNOSTIC
def __init__(self, instance, ac_key, zone_key): def __init__(self, instance, ac_key, zone_key):
"""Initialize an Advantage Air Zone Vent Sensor.""" """Initialize an Advantage Air Zone Vent Sensor."""
@ -115,7 +116,7 @@ class AdvantageAirZoneSignal(AdvantageAirEntity, SensorEntity):
_attr_native_unit_of_measurement = PERCENTAGE _attr_native_unit_of_measurement = PERCENTAGE
_attr_state_class = SensorStateClass.MEASUREMENT _attr_state_class = SensorStateClass.MEASUREMENT
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC _attr_entity_category = EntityCategory.DIAGNOSTIC
def __init__(self, instance, ac_key, zone_key): def __init__(self, instance, ac_key, zone_key):
"""Initialize an Advantage Air Zone wireless signal sensor.""" """Initialize an Advantage Air Zone wireless signal sensor."""
@ -148,10 +149,10 @@ class AdvantageAirZoneTemp(AdvantageAirEntity, SensorEntity):
"""Representation of Advantage Air Zone temperature sensor.""" """Representation of Advantage Air Zone temperature sensor."""
_attr_native_unit_of_measurement = TEMP_CELSIUS _attr_native_unit_of_measurement = TEMP_CELSIUS
_attr_device_class = DEVICE_CLASS_TEMPERATURE _attr_device_class = SensorDeviceClass.TEMPERATURE
_attr_state_class = SensorStateClass.MEASUREMENT _attr_state_class = SensorStateClass.MEASUREMENT
_attr_entity_registry_enabled_default = False _attr_entity_registry_enabled_default = False
_attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC _attr_entity_category = EntityCategory.DIAGNOSTIC
def __init__(self, instance, ac_key, zone_key): def __init__(self, instance, ac_key, zone_key):
"""Initialize an Advantage Air Zone Temp Sensor.""" """Initialize an Advantage Air Zone Temp Sensor."""