Use enums in ring (#62041)

This commit is contained in:
Robert Hillis 2021-12-16 08:12:57 -05:00 committed by GitHub
parent 0cf0104662
commit 9e30e0c9bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View file

@ -5,8 +5,7 @@ from dataclasses import dataclass
from datetime import datetime
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OCCUPANCY,
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
@ -35,13 +34,13 @@ BINARY_SENSOR_TYPES: tuple[RingBinarySensorEntityDescription, ...] = (
key="ding",
name="Ding",
category=["doorbots", "authorized_doorbots"],
device_class=DEVICE_CLASS_OCCUPANCY,
device_class=BinarySensorDeviceClass.OCCUPANCY,
),
RingBinarySensorEntityDescription(
key="motion",
name="Motion",
category=["doorbots", "authorized_doorbots", "stickup_cams"],
device_class=DEVICE_CLASS_MOTION,
device_class=BinarySensorDeviceClass.MOTION,
),
)

View file

@ -3,12 +3,12 @@ from __future__ import annotations
from dataclasses import dataclass
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription
from homeassistant.const import (
DEVICE_CLASS_TIMESTAMP,
PERCENTAGE,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.const import PERCENTAGE, SIGNAL_STRENGTH_DECIBELS_MILLIWATT
from homeassistant.core import callback
from homeassistant.helpers.icon import icon_for_battery_level
@ -209,7 +209,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
name="Last Activity",
category=["doorbots", "authorized_doorbots", "stickup_cams"],
icon="mdi:history",
device_class=DEVICE_CLASS_TIMESTAMP,
device_class=SensorDeviceClass.TIMESTAMP,
cls=HistoryRingSensor,
),
RingSensorEntityDescription(
@ -218,7 +218,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
category=["doorbots", "authorized_doorbots"],
icon="mdi:history",
kind="ding",
device_class=DEVICE_CLASS_TIMESTAMP,
device_class=SensorDeviceClass.TIMESTAMP,
cls=HistoryRingSensor,
),
RingSensorEntityDescription(
@ -227,7 +227,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
category=["doorbots", "authorized_doorbots", "stickup_cams"],
icon="mdi:history",
kind="motion",
device_class=DEVICE_CLASS_TIMESTAMP,
device_class=SensorDeviceClass.TIMESTAMP,
cls=HistoryRingSensor,
),
RingSensorEntityDescription(