Use new DeviceClass enums in blink (#61315)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-09 09:13:50 +01:00 committed by GitHub
parent 730208028f
commit 23f21bd27a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View file

@ -2,8 +2,7 @@
from __future__ import annotations from __future__ import annotations
from homeassistant.components.binary_sensor import ( from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY, BinarySensorDeviceClass,
DEVICE_CLASS_MOTION,
BinarySensorEntity, BinarySensorEntity,
BinarySensorEntityDescription, BinarySensorEntityDescription,
) )
@ -14,7 +13,7 @@ BINARY_SENSORS_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription( BinarySensorEntityDescription(
key=TYPE_BATTERY, key=TYPE_BATTERY,
name="Battery", name="Battery",
device_class=DEVICE_CLASS_BATTERY, device_class=BinarySensorDeviceClass.BATTERY,
), ),
BinarySensorEntityDescription( BinarySensorEntityDescription(
key=TYPE_CAMERA_ARMED, key=TYPE_CAMERA_ARMED,
@ -23,7 +22,7 @@ BINARY_SENSORS_TYPES: tuple[BinarySensorEntityDescription, ...] = (
BinarySensorEntityDescription( BinarySensorEntityDescription(
key=TYPE_MOTION_DETECTED, key=TYPE_MOTION_DETECTED,
name="Motion Detected", name="Motion Detected",
device_class=DEVICE_CLASS_MOTION, device_class=BinarySensorDeviceClass.MOTION,
), ),
) )

View file

@ -3,13 +3,12 @@ from __future__ import annotations
import logging import logging
from homeassistant.components.sensor import SensorEntity, SensorEntityDescription from homeassistant.components.sensor import (
from homeassistant.const import ( SensorDeviceClass,
DEVICE_CLASS_SIGNAL_STRENGTH, SensorEntity,
DEVICE_CLASS_TEMPERATURE, SensorEntityDescription,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
TEMP_FAHRENHEIT,
) )
from homeassistant.const import SIGNAL_STRENGTH_DECIBELS_MILLIWATT, TEMP_FAHRENHEIT
from .const import DOMAIN, TYPE_TEMPERATURE, TYPE_WIFI_STRENGTH from .const import DOMAIN, TYPE_TEMPERATURE, TYPE_WIFI_STRENGTH
@ -20,13 +19,13 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key=TYPE_TEMPERATURE, key=TYPE_TEMPERATURE,
name="Temperature", name="Temperature",
native_unit_of_measurement=TEMP_FAHRENHEIT, native_unit_of_measurement=TEMP_FAHRENHEIT,
device_class=DEVICE_CLASS_TEMPERATURE, device_class=SensorDeviceClass.TEMPERATURE,
), ),
SensorEntityDescription( SensorEntityDescription(
key=TYPE_WIFI_STRENGTH, key=TYPE_WIFI_STRENGTH,
name="Wifi Signal", name="Wifi Signal",
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT, native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
device_class=DEVICE_CLASS_SIGNAL_STRENGTH, device_class=SensorDeviceClass.SIGNAL_STRENGTH,
), ),
) )