From 7215244c176660a5920623d09bd1cb3a6c2fa775 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 8 Dec 2021 21:19:10 +0100 Subject: [PATCH] Use new DeviceClass and EntityCategory enums in advantage_air (#61255) Co-authored-by: epenet --- .../components/advantage_air/binary_sensor.py | 13 ++++++------- homeassistant/components/advantage_air/cover.py | 4 ++-- homeassistant/components/advantage_air/sensor.py | 15 ++++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/advantage_air/binary_sensor.py b/homeassistant/components/advantage_air/binary_sensor.py index eec0ce7dfa5..3a0990c55ef 100644 --- a/homeassistant/components/advantage_air/binary_sensor.py +++ b/homeassistant/components/advantage_air/binary_sensor.py @@ -1,11 +1,10 @@ """Binary Sensor platform for Advantage Air integration.""" from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_MOTION, - DEVICE_CLASS_PROBLEM, + BinarySensorDeviceClass, BinarySensorEntity, ) -from homeassistant.const import ENTITY_CATEGORY_DIAGNOSTIC +from homeassistant.helpers.entity import EntityCategory from .const import DOMAIN as ADVANTAGE_AIR_DOMAIN from .entity import AdvantageAirEntity @@ -34,8 +33,8 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class AdvantageAirZoneFilter(AdvantageAirEntity, BinarySensorEntity): """Advantage Air Filter.""" - _attr_device_class = DEVICE_CLASS_PROBLEM - _attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC + _attr_device_class = BinarySensorDeviceClass.PROBLEM + _attr_entity_category = EntityCategory.DIAGNOSTIC def __init__(self, instance, ac_key): """Initialize an Advantage Air Filter.""" @@ -54,7 +53,7 @@ class AdvantageAirZoneFilter(AdvantageAirEntity, BinarySensorEntity): class AdvantageAirZoneMotion(AdvantageAirEntity, BinarySensorEntity): """Advantage Air Zone Motion.""" - _attr_device_class = DEVICE_CLASS_MOTION + _attr_device_class = BinarySensorDeviceClass.MOTION def __init__(self, instance, ac_key, zone_key): """Initialize an Advantage Air Zone Motion.""" @@ -74,7 +73,7 @@ class AdvantageAirZoneMyZone(AdvantageAirEntity, BinarySensorEntity): """Advantage Air Zone MyZone.""" _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): """Initialize an Advantage Air Zone MyZone.""" diff --git a/homeassistant/components/advantage_air/cover.py b/homeassistant/components/advantage_air/cover.py index 04960dab002..d308a024f14 100644 --- a/homeassistant/components/advantage_air/cover.py +++ b/homeassistant/components/advantage_air/cover.py @@ -2,10 +2,10 @@ from homeassistant.components.cover import ( ATTR_POSITION, - DEVICE_CLASS_DAMPER, SUPPORT_CLOSE, SUPPORT_OPEN, SUPPORT_SET_POSITION, + CoverDeviceClass, CoverEntity, ) @@ -36,7 +36,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities): class AdvantageAirZoneVent(AdvantageAirEntity, CoverEntity): """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 def __init__(self, instance, ac_key, zone_key): diff --git a/homeassistant/components/advantage_air/sensor.py b/homeassistant/components/advantage_air/sensor.py index 8b83de2b923..bb3082a84bb 100644 --- a/homeassistant/components/advantage_air/sensor.py +++ b/homeassistant/components/advantage_air/sensor.py @@ -2,12 +2,13 @@ import voluptuous as vol from homeassistant.components.sensor import ( - DEVICE_CLASS_TEMPERATURE, + SensorDeviceClass, SensorEntity, 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.entity import EntityCategory from .const import ADVANTAGE_AIR_STATE_OPEN, DOMAIN as ADVANTAGE_AIR_DOMAIN from .entity import AdvantageAirEntity @@ -50,7 +51,7 @@ class AdvantageAirTimeTo(AdvantageAirEntity, SensorEntity): """Representation of Advantage Air timer control.""" _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): """Initialize the Advantage Air timer control.""" @@ -85,7 +86,7 @@ class AdvantageAirZoneVent(AdvantageAirEntity, SensorEntity): _attr_native_unit_of_measurement = PERCENTAGE _attr_state_class = SensorStateClass.MEASUREMENT - _attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC + _attr_entity_category = EntityCategory.DIAGNOSTIC def __init__(self, instance, ac_key, zone_key): """Initialize an Advantage Air Zone Vent Sensor.""" @@ -115,7 +116,7 @@ class AdvantageAirZoneSignal(AdvantageAirEntity, SensorEntity): _attr_native_unit_of_measurement = PERCENTAGE _attr_state_class = SensorStateClass.MEASUREMENT - _attr_entity_category = ENTITY_CATEGORY_DIAGNOSTIC + _attr_entity_category = EntityCategory.DIAGNOSTIC def __init__(self, instance, ac_key, zone_key): """Initialize an Advantage Air Zone wireless signal sensor.""" @@ -148,10 +149,10 @@ class AdvantageAirZoneTemp(AdvantageAirEntity, SensorEntity): """Representation of Advantage Air Zone temperature sensor.""" _attr_native_unit_of_measurement = TEMP_CELSIUS - _attr_device_class = DEVICE_CLASS_TEMPERATURE + _attr_device_class = SensorDeviceClass.TEMPERATURE _attr_state_class = SensorStateClass.MEASUREMENT _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): """Initialize an Advantage Air Zone Temp Sensor."""