Use enums in ring (#62041)
This commit is contained in:
parent
0cf0104662
commit
9e30e0c9bd
2 changed files with 11 additions and 12 deletions
|
@ -5,8 +5,7 @@ from dataclasses import dataclass
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
DEVICE_CLASS_MOTION,
|
BinarySensorDeviceClass,
|
||||||
DEVICE_CLASS_OCCUPANCY,
|
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
BinarySensorEntityDescription,
|
BinarySensorEntityDescription,
|
||||||
)
|
)
|
||||||
|
@ -35,13 +34,13 @@ BINARY_SENSOR_TYPES: tuple[RingBinarySensorEntityDescription, ...] = (
|
||||||
key="ding",
|
key="ding",
|
||||||
name="Ding",
|
name="Ding",
|
||||||
category=["doorbots", "authorized_doorbots"],
|
category=["doorbots", "authorized_doorbots"],
|
||||||
device_class=DEVICE_CLASS_OCCUPANCY,
|
device_class=BinarySensorDeviceClass.OCCUPANCY,
|
||||||
),
|
),
|
||||||
RingBinarySensorEntityDescription(
|
RingBinarySensorEntityDescription(
|
||||||
key="motion",
|
key="motion",
|
||||||
name="Motion",
|
name="Motion",
|
||||||
category=["doorbots", "authorized_doorbots", "stickup_cams"],
|
category=["doorbots", "authorized_doorbots", "stickup_cams"],
|
||||||
device_class=DEVICE_CLASS_MOTION,
|
device_class=BinarySensorDeviceClass.MOTION,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,12 +3,12 @@ from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
|
from homeassistant.components.sensor import (
|
||||||
from homeassistant.const import (
|
SensorDeviceClass,
|
||||||
DEVICE_CLASS_TIMESTAMP,
|
SensorEntity,
|
||||||
PERCENTAGE,
|
SensorEntityDescription,
|
||||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import PERCENTAGE, SIGNAL_STRENGTH_DECIBELS_MILLIWATT
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers.icon import icon_for_battery_level
|
from homeassistant.helpers.icon import icon_for_battery_level
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
|
||||||
name="Last Activity",
|
name="Last Activity",
|
||||||
category=["doorbots", "authorized_doorbots", "stickup_cams"],
|
category=["doorbots", "authorized_doorbots", "stickup_cams"],
|
||||||
icon="mdi:history",
|
icon="mdi:history",
|
||||||
device_class=DEVICE_CLASS_TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
cls=HistoryRingSensor,
|
cls=HistoryRingSensor,
|
||||||
),
|
),
|
||||||
RingSensorEntityDescription(
|
RingSensorEntityDescription(
|
||||||
|
@ -218,7 +218,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
|
||||||
category=["doorbots", "authorized_doorbots"],
|
category=["doorbots", "authorized_doorbots"],
|
||||||
icon="mdi:history",
|
icon="mdi:history",
|
||||||
kind="ding",
|
kind="ding",
|
||||||
device_class=DEVICE_CLASS_TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
cls=HistoryRingSensor,
|
cls=HistoryRingSensor,
|
||||||
),
|
),
|
||||||
RingSensorEntityDescription(
|
RingSensorEntityDescription(
|
||||||
|
@ -227,7 +227,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
|
||||||
category=["doorbots", "authorized_doorbots", "stickup_cams"],
|
category=["doorbots", "authorized_doorbots", "stickup_cams"],
|
||||||
icon="mdi:history",
|
icon="mdi:history",
|
||||||
kind="motion",
|
kind="motion",
|
||||||
device_class=DEVICE_CLASS_TIMESTAMP,
|
device_class=SensorDeviceClass.TIMESTAMP,
|
||||||
cls=HistoryRingSensor,
|
cls=HistoryRingSensor,
|
||||||
),
|
),
|
||||||
RingSensorEntityDescription(
|
RingSensorEntityDescription(
|
||||||
|
|
Loading…
Add table
Reference in a new issue