Use new DeviceClass enums in abode (#61244)

Co-authored-by: epenet <epenet@users.noreply.github.com>
pull/61254/head
epenet 2021-12-08 19:58:01 +01:00 committed by GitHub
parent d03b73eb23
commit 40828e221e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 10 deletions

View File

@ -2,7 +2,7 @@
import abodepy.helpers.constants as CONST
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_WINDOW,
BinarySensorDeviceClass,
BinarySensorEntity,
)
@ -42,5 +42,5 @@ class AbodeBinarySensor(AbodeDevice, BinarySensorEntity):
def device_class(self):
"""Return the class of the binary sensor."""
if self._device.get_value("is_window") == "1":
return DEVICE_CLASS_WINDOW
return BinarySensorDeviceClass.WINDOW
return self._device.generic_type

View File

@ -3,11 +3,10 @@ from __future__ import annotations
import abodepy.helpers.constants as CONST
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_ILLUMINANCE,
DEVICE_CLASS_TEMPERATURE,
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from . import AbodeDevice
@ -17,17 +16,17 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription(
key=CONST.TEMP_STATUS_KEY,
name="Temperature",
device_class=DEVICE_CLASS_TEMPERATURE,
device_class=SensorDeviceClass.TEMPERATURE,
),
SensorEntityDescription(
key=CONST.HUMI_STATUS_KEY,
name="Humidity",
device_class=DEVICE_CLASS_HUMIDITY,
device_class=SensorDeviceClass.HUMIDITY,
),
SensorEntityDescription(
key=CONST.LUX_STATUS_KEY,
name="Lux",
device_class=DEVICE_CLASS_ILLUMINANCE,
device_class=SensorDeviceClass.ILLUMINANCE,
),
)