From f59966f8ee1a3a5e5680bb7467bd9954866e8a5d Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Fri, 10 Dec 2021 08:57:31 +0100 Subject: [PATCH] Use new DeviceClass enums in econet (#61375) Co-authored-by: epenet --- homeassistant/components/econet/binary_sensor.py | 13 +++++-------- homeassistant/components/econet/sensor.py | 11 +++-------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/econet/binary_sensor.py b/homeassistant/components/econet/binary_sensor.py index cb7945e0815..6cee3383d23 100644 --- a/homeassistant/components/econet/binary_sensor.py +++ b/homeassistant/components/econet/binary_sensor.py @@ -4,10 +4,7 @@ from __future__ import annotations from pyeconet.equipment import EquipmentType from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_LOCK, - DEVICE_CLASS_OPENING, - DEVICE_CLASS_POWER, - DEVICE_CLASS_SOUND, + BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription, ) @@ -19,22 +16,22 @@ BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = ( BinarySensorEntityDescription( key="shutoff_valve_open", name="shutoff_valve", - device_class=DEVICE_CLASS_OPENING, + device_class=BinarySensorDeviceClass.OPENING, ), BinarySensorEntityDescription( key="running", name="running", - device_class=DEVICE_CLASS_POWER, + device_class=BinarySensorDeviceClass.POWER, ), BinarySensorEntityDescription( key="screen_locked", name="screen_locked", - device_class=DEVICE_CLASS_LOCK, + device_class=BinarySensorDeviceClass.LOCK, ), BinarySensorEntityDescription( key="beep_enabled", name="beep_enabled", - device_class=DEVICE_CLASS_SOUND, + device_class=BinarySensorDeviceClass.SOUND, ), ) diff --git a/homeassistant/components/econet/sensor.py b/homeassistant/components/econet/sensor.py index bbcf54003e8..f4c37841b17 100644 --- a/homeassistant/components/econet/sensor.py +++ b/homeassistant/components/econet/sensor.py @@ -1,13 +1,8 @@ """Support for Rheem EcoNet water heaters.""" from pyeconet.equipment import EquipmentType -from homeassistant.components.sensor import SensorEntity -from homeassistant.const import ( - DEVICE_CLASS_SIGNAL_STRENGTH, - ENERGY_KILO_WATT_HOUR, - PERCENTAGE, - VOLUME_GALLONS, -) +from homeassistant.components.sensor import SensorDeviceClass, SensorEntity +from homeassistant.const import ENERGY_KILO_WATT_HOUR, PERCENTAGE, VOLUME_GALLONS from . import EcoNetEntity from .const import DOMAIN, EQUIPMENT @@ -44,7 +39,7 @@ SENSOR_NAMES_TO_UNIT_OF_MEASUREMENT = { WATER_USAGE_TODAY: VOLUME_GALLONS, POWER_USAGE_TODAY: None, # Depends on unit type ALERT_COUNT: None, - WIFI_SIGNAL: DEVICE_CLASS_SIGNAL_STRENGTH, + WIFI_SIGNAL: SensorDeviceClass.SIGNAL_STRENGTH, RUNNING_STATE: None, # This is just a string }