From 40828e221efee7497ec46c8fb4ff4bf1e6db1a8a Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 8 Dec 2021 19:58:01 +0100 Subject: [PATCH] Use new DeviceClass enums in abode (#61244) Co-authored-by: epenet --- homeassistant/components/abode/binary_sensor.py | 4 ++-- homeassistant/components/abode/sensor.py | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/abode/binary_sensor.py b/homeassistant/components/abode/binary_sensor.py index 7175fbc550a..ea921470e8f 100644 --- a/homeassistant/components/abode/binary_sensor.py +++ b/homeassistant/components/abode/binary_sensor.py @@ -2,7 +2,7 @@ import abodepy.helpers.constants as CONST from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_WINDOW, + BinarySensorDeviceClass, BinarySensorEntity, ) @@ -42,5 +42,5 @@ class AbodeBinarySensor(AbodeDevice, BinarySensorEntity): def device_class(self): """Return the class of the binary sensor.""" if self._device.get_value("is_window") == "1": - return DEVICE_CLASS_WINDOW + return BinarySensorDeviceClass.WINDOW return self._device.generic_type diff --git a/homeassistant/components/abode/sensor.py b/homeassistant/components/abode/sensor.py index 03687fc3907..ebc45370062 100644 --- a/homeassistant/components/abode/sensor.py +++ b/homeassistant/components/abode/sensor.py @@ -3,11 +3,10 @@ from __future__ import annotations import abodepy.helpers.constants as CONST -from homeassistant.components.sensor import SensorEntity, SensorEntityDescription -from homeassistant.const import ( - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_ILLUMINANCE, - DEVICE_CLASS_TEMPERATURE, +from homeassistant.components.sensor import ( + SensorDeviceClass, + SensorEntity, + SensorEntityDescription, ) from . import AbodeDevice @@ -17,17 +16,17 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = ( SensorEntityDescription( key=CONST.TEMP_STATUS_KEY, name="Temperature", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, ), SensorEntityDescription( key=CONST.HUMI_STATUS_KEY, name="Humidity", - device_class=DEVICE_CLASS_HUMIDITY, + device_class=SensorDeviceClass.HUMIDITY, ), SensorEntityDescription( key=CONST.LUX_STATUS_KEY, name="Lux", - device_class=DEVICE_CLASS_ILLUMINANCE, + device_class=SensorDeviceClass.ILLUMINANCE, ), )