mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Use new DeviceClass enums in abode (#61244)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
d03b73eb23
commit
40828e221e
@ -2,7 +2,7 @@
|
|||||||
import abodepy.helpers.constants as CONST
|
import abodepy.helpers.constants as CONST
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_WINDOW,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,5 +42,5 @@ class AbodeBinarySensor(AbodeDevice, BinarySensorEntity):
|
|||||||
def device_class(self):
|
def device_class(self):
|
||||||
"""Return the class of the binary sensor."""
|
"""Return the class of the binary sensor."""
|
||||||
if self._device.get_value("is_window") == "1":
|
if self._device.get_value("is_window") == "1":
|
||||||
return DEVICE_CLASS_WINDOW
|
return BinarySensorDeviceClass.WINDOW
|
||||||
return self._device.generic_type
|
return self._device.generic_type
|
||||||
|
@ -3,11 +3,10 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import abodepy.helpers.constants as CONST
|
import abodepy.helpers.constants as CONST
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
from homeassistant.components.sensor import (
|
||||||
from homeassistant.const import (
|
SensorDeviceClass,
|
||||||
DEVICE_CLASS_HUMIDITY,
|
SensorEntity,
|
||||||
DEVICE_CLASS_ILLUMINANCE,
|
SensorEntityDescription,
|
||||||
DEVICE_CLASS_TEMPERATURE,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from . import AbodeDevice
|
from . import AbodeDevice
|
||||||
@ -17,17 +16,17 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
|
|||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CONST.TEMP_STATUS_KEY,
|
key=CONST.TEMP_STATUS_KEY,
|
||||||
name="Temperature",
|
name="Temperature",
|
||||||
device_class=DEVICE_CLASS_TEMPERATURE,
|
device_class=SensorDeviceClass.TEMPERATURE,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CONST.HUMI_STATUS_KEY,
|
key=CONST.HUMI_STATUS_KEY,
|
||||||
name="Humidity",
|
name="Humidity",
|
||||||
device_class=DEVICE_CLASS_HUMIDITY,
|
device_class=SensorDeviceClass.HUMIDITY,
|
||||||
),
|
),
|
||||||
SensorEntityDescription(
|
SensorEntityDescription(
|
||||||
key=CONST.LUX_STATUS_KEY,
|
key=CONST.LUX_STATUS_KEY,
|
||||||
name="Lux",
|
name="Lux",
|
||||||
device_class=DEVICE_CLASS_ILLUMINANCE,
|
device_class=SensorDeviceClass.ILLUMINANCE,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user