From c4c9dc8cee5eef717b5d81f5d291ee42e4654d01 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 16 Dec 2021 22:45:27 +0100 Subject: [PATCH] Use new enums in neurio_energy (#61953) --- .../components/neurio_energy/sensor.py | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/neurio_energy/sensor.py b/homeassistant/components/neurio_energy/sensor.py index b316281faa1..99bc41e84ce 100644 --- a/homeassistant/components/neurio_energy/sensor.py +++ b/homeassistant/components/neurio_energy/sensor.py @@ -10,17 +10,11 @@ import voluptuous as vol from homeassistant.components.sensor import ( PLATFORM_SCHEMA, - STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL_INCREASING, + SensorDeviceClass, SensorEntity, + SensorStateClass, ) -from homeassistant.const import ( - CONF_API_KEY, - DEVICE_CLASS_ENERGY, - DEVICE_CLASS_POWER, - ENERGY_KILO_WATT_HOUR, - POWER_WATT, -) +from homeassistant.const import CONF_API_KEY, ENERGY_KILO_WATT_HOUR, POWER_WATT import homeassistant.helpers.config_validation as cv from homeassistant.util import Throttle import homeassistant.util.dt as dt_util @@ -148,12 +142,12 @@ class NeurioEnergy(SensorEntity): if sensor_type == ACTIVE_TYPE: self._unit_of_measurement = POWER_WATT - self._attr_device_class = DEVICE_CLASS_POWER - self._attr_state_class = STATE_CLASS_MEASUREMENT + self._attr_device_class = SensorDeviceClass.POWER + self._attr_state_class = SensorStateClass.MEASUREMENT elif sensor_type == DAILY_TYPE: self._unit_of_measurement = ENERGY_KILO_WATT_HOUR - self._attr_device_class = DEVICE_CLASS_ENERGY - self._attr_state_class = STATE_CLASS_TOTAL_INCREASING + self._attr_device_class = SensorDeviceClass.ENERGY + self._attr_state_class = SensorStateClass.TOTAL_INCREASING @property def name(self):