From af91addc6cf979fb08acc7cf1b43c25faf663764 Mon Sep 17 00:00:00 2001 From: Dave T <17680170+davet2001@users.noreply.github.com> Date: Wed, 8 Dec 2021 17:01:52 +0000 Subject: [PATCH] Use SensorDeviceClass and SensorStateClass enums in Aurora ABB (#61245) --- .../components/aurora_abb_powerone/sensor.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/aurora_abb_powerone/sensor.py b/homeassistant/components/aurora_abb_powerone/sensor.py index 35be4e2b7d7..59c74e221bd 100644 --- a/homeassistant/components/aurora_abb_powerone/sensor.py +++ b/homeassistant/components/aurora_abb_powerone/sensor.py @@ -10,19 +10,16 @@ import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, - STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL_INCREASING, + SensorDeviceClass, SensorEntity, SensorEntityDescription, + SensorStateClass, ) from homeassistant.config_entries import SOURCE_IMPORT from homeassistant.const import ( CONF_ADDRESS, CONF_DEVICE, CONF_NAME, - DEVICE_CLASS_ENERGY, - DEVICE_CLASS_POWER, - DEVICE_CLASS_TEMPERATURE, ENERGY_KILO_WATT_HOUR, POWER_WATT, TEMP_CELSIUS, @@ -37,23 +34,23 @@ _LOGGER = logging.getLogger(__name__) SENSOR_TYPES = [ SensorEntityDescription( key="instantaneouspower", - device_class=DEVICE_CLASS_POWER, + device_class=SensorDeviceClass.POWER, native_unit_of_measurement=POWER_WATT, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Power Output", ), SensorEntityDescription( key="temp", - device_class=DEVICE_CLASS_TEMPERATURE, + device_class=SensorDeviceClass.TEMPERATURE, native_unit_of_measurement=TEMP_CELSIUS, - state_class=STATE_CLASS_MEASUREMENT, + state_class=SensorStateClass.MEASUREMENT, name="Temperature", ), SensorEntityDescription( key="totalenergy", - device_class=DEVICE_CLASS_ENERGY, + device_class=SensorDeviceClass.ENERGY, native_unit_of_measurement=ENERGY_KILO_WATT_HOUR, - state_class=STATE_CLASS_TOTAL_INCREASING, + state_class=SensorStateClass.TOTAL_INCREASING, name="Total Energy", ), ]