From bae82d76b5054452beacd39d504d742a8e361323 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Mon, 20 Dec 2021 18:06:33 +0100 Subject: [PATCH] Use new enums in spider (#62396) Co-authored-by: epenet --- homeassistant/components/spider/sensor.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/spider/sensor.py b/homeassistant/components/spider/sensor.py index c390e060194..eb7259b0412 100644 --- a/homeassistant/components/spider/sensor.py +++ b/homeassistant/components/spider/sensor.py @@ -1,15 +1,10 @@ """Support for Spider Powerplugs (energy & power).""" from homeassistant.components.sensor import ( - STATE_CLASS_MEASUREMENT, - STATE_CLASS_TOTAL_INCREASING, + SensorDeviceClass, SensorEntity, + SensorStateClass, ) -from homeassistant.const import ( - DEVICE_CLASS_ENERGY, - DEVICE_CLASS_POWER, - ENERGY_KILO_WATT_HOUR, - POWER_WATT, -) +from homeassistant.const import ENERGY_KILO_WATT_HOUR, POWER_WATT from homeassistant.helpers.entity import DeviceInfo from .const import DOMAIN @@ -31,8 +26,8 @@ class SpiderPowerPlugEnergy(SensorEntity): """Representation of a Spider Power Plug (energy).""" _attr_native_unit_of_measurement = ENERGY_KILO_WATT_HOUR - _attr_device_class = DEVICE_CLASS_ENERGY - _attr_state_class = STATE_CLASS_TOTAL_INCREASING + _attr_device_class = SensorDeviceClass.ENERGY + _attr_state_class = SensorStateClass.TOTAL_INCREASING def __init__(self, api, power_plug) -> None: """Initialize the Spider Power Plug.""" @@ -72,8 +67,8 @@ class SpiderPowerPlugEnergy(SensorEntity): class SpiderPowerPlugPower(SensorEntity): """Representation of a Spider Power Plug (power).""" - _attr_device_class = DEVICE_CLASS_POWER - _attr_state_class = STATE_CLASS_MEASUREMENT + _attr_device_class = SensorDeviceClass.POWER + _attr_state_class = SensorStateClass.MEASUREMENT _attr_native_unit_of_measurement = POWER_WATT def __init__(self, api, power_plug) -> None: