Use enums in screenlogic ()

This commit is contained in:
Robert Hillis 2021-12-16 12:38:32 -05:00 committed by GitHub
parent 21e46e318d
commit 31bef18e9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions
homeassistant/components/screenlogic

View file

@ -2,14 +2,14 @@
from screenlogicpy.const import DATA as SL_DATA, DEVICE_TYPE, EQUIPMENT, ON_OFF from screenlogicpy.const import DATA as SL_DATA, DEVICE_TYPE, EQUIPMENT, ON_OFF
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_PROBLEM, BinarySensorDeviceClass,
BinarySensorEntity, BinarySensorEntity,
) )
from . import ScreenlogicEntity from . import ScreenlogicEntity
from .const import DOMAIN 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): async def async_setup_entry(hass, config_entry, async_add_entities):

View file

@ -6,11 +6,7 @@ from screenlogicpy.const import (
EQUIPMENT, EQUIPMENT,
) )
from homeassistant.components.sensor import ( from homeassistant.components.sensor import SensorDeviceClass, SensorEntity
DEVICE_CLASS_POWER,
DEVICE_CLASS_TEMPERATURE,
SensorEntity,
)
from . import ScreenlogicEntity from . import ScreenlogicEntity
from .const import DOMAIN from .const import DOMAIN
@ -41,8 +37,8 @@ SUPPORTED_SCG_SENSORS = (
SUPPORTED_PUMP_SENSORS = ("currentWatts", "currentRPM", "currentGPM") SUPPORTED_PUMP_SENSORS = ("currentWatts", "currentRPM", "currentGPM")
SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS = { SL_DEVICE_TYPE_TO_HA_DEVICE_CLASS = {
DEVICE_TYPE.TEMPERATURE: DEVICE_CLASS_TEMPERATURE, DEVICE_TYPE.TEMPERATURE: SensorDeviceClass.TEMPERATURE,
DEVICE_TYPE.ENERGY: DEVICE_CLASS_POWER, DEVICE_TYPE.ENERGY: SensorDeviceClass.POWER,
} }