From 31bef18e9a0a8e4098c8cba8d50eeb8d545b1a33 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Thu, 16 Dec 2021 12:38:32 -0500 Subject: [PATCH] Use enums in screenlogic (#62049) --- homeassistant/components/screenlogic/binary_sensor.py | 4 ++-- homeassistant/components/screenlogic/sensor.py | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/homeassistant/components/screenlogic/binary_sensor.py b/homeassistant/components/screenlogic/binary_sensor.py index 136f74d0d6c..4c961f9b12a 100644 --- a/homeassistant/components/screenlogic/binary_sensor.py +++ b/homeassistant/components/screenlogic/binary_sensor.py @@ -2,14 +2,14 @@ from screenlogicpy.const import DATA as SL_DATA, DEVICE_TYPE, EQUIPMENT, ON_OFF from homeassistant.components.binary_sensor import ( - DEVICE_CLASS_PROBLEM, + BinarySensorDeviceClass, BinarySensorEntity, ) from . import ScreenlogicEntity from .const import DOMAIN -SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS = {DEVICE_TYPE.ALARM: DEVICE_CLASS_PROBLEM} +SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS = {DEVICE_TYPE.ALARM: BinarySensorDeviceClass.PROBLEM} async def async_setup_entry(hass, config_entry, async_add_entities): diff --git a/homeassistant/components/screenlogic/sensor.py b/homeassistant/components/screenlogic/sensor.py index 7ab20164400..0f2d140f669 100644 --- a/homeassistant/components/screenlogic/sensor.py +++ b/homeassistant/components/screenlogic/sensor.py @@ -6,11 +6,7 @@ from screenlogicpy.const import ( EQUIPMENT, ) -from homeassistant.components.sensor import ( - DEVICE_CLASS_POWER, - DEVICE_CLASS_TEMPERATURE, - SensorEntity, -) +from homeassistant.components.sensor import SensorDeviceClass, SensorEntity from . import ScreenlogicEntity from .const import DOMAIN @@ -41,8 +37,8 @@ SUPPORTED_SCG_SENSORS = ( SUPPORTED_PUMP_SENSORS = ("currentWatts", "currentRPM", "currentGPM") SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS = { - DEVICE_TYPE.TEMPERATURE: DEVICE_CLASS_TEMPERATURE, - DEVICE_TYPE.ENERGY: DEVICE_CLASS_POWER, + DEVICE_TYPE.TEMPERATURE: SensorDeviceClass.TEMPERATURE, + DEVICE_TYPE.ENERGY: SensorDeviceClass.POWER, }