From 63efb809eefffa5b6acf9deae379d3892d525373 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 10 Dec 2021 09:10:36 +0100 Subject: [PATCH] Use new DeviceClass and StateClass enums in enocean (#61387) Co-authored-by: epenet --- homeassistant/components/enocean/sensor.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/homeassistant/components/enocean/sensor.py b/homeassistant/components/enocean/sensor.py index 9c4c9df73e9..657c4ed4ecd 100644 --- a/homeassistant/components/enocean/sensor.py +++ b/homeassistant/components/enocean/sensor.py @@ -5,17 +5,15 @@ import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, - STATE_CLASS_MEASUREMENT, + SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.const import ( CONF_DEVICE_CLASS, CONF_ID, CONF_NAME, - DEVICE_CLASS_HUMIDITY, - DEVICE_CLASS_POWER, - DEVICE_CLASS_TEMPERATURE, PERCENTAGE, POWER_WATT, STATE_CLOSED, @@ -44,8 +42,8 @@ SENSOR_DESC_TEMPERATURE = SensorEntityDescription( name="Temperature", native_unit_of_measurement=TEMP_CELSIUS, icon="mdi:thermometer", - device_class=DEVICE_CLASS_TEMPERATURE, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.TEMPERATURE, + state_class=SensorStateClass.MEASUREMENT, ) SENSOR_DESC_HUMIDITY = SensorEntityDescription( @@ -53,8 +51,8 @@ SENSOR_DESC_HUMIDITY = SensorEntityDescription( name="Humidity", native_unit_of_measurement=PERCENTAGE, icon="mdi:water-percent", - device_class=DEVICE_CLASS_HUMIDITY, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.HUMIDITY, + state_class=SensorStateClass.MEASUREMENT, ) SENSOR_DESC_POWER = SensorEntityDescription( @@ -62,8 +60,8 @@ SENSOR_DESC_POWER = SensorEntityDescription( name="Power", native_unit_of_measurement=POWER_WATT, icon="mdi:power-plug", - device_class=DEVICE_CLASS_POWER, - state_class=STATE_CLASS_MEASUREMENT, + device_class=SensorDeviceClass.POWER, + state_class=SensorStateClass.MEASUREMENT, ) SENSOR_DESC_WINDOWHANDLE = SensorEntityDescription(