Use device class enum instead of string (#82935)
This commit is contained in:
parent
2d7701cab5
commit
a69e0defe6
3 changed files with 9 additions and 6 deletions
|
@ -206,7 +206,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
|
|||
name="Battery",
|
||||
category=["doorbots", "authorized_doorbots", "stickup_cams"],
|
||||
native_unit_of_measurement=PERCENTAGE,
|
||||
device_class="battery",
|
||||
device_class=SensorDeviceClass.BATTERY,
|
||||
cls=RingSensor,
|
||||
),
|
||||
RingSensorEntityDescription(
|
||||
|
@ -255,7 +255,7 @@ SENSOR_TYPES: tuple[RingSensorEntityDescription, ...] = (
|
|||
category=["chimes", "doorbots", "authorized_doorbots", "stickup_cams"],
|
||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
icon="mdi:wifi",
|
||||
device_class="signal_strength",
|
||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||
cls=HealthDataRingSensor,
|
||||
),
|
||||
)
|
||||
|
|
|
@ -5,7 +5,11 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity
|
||||
from homeassistant.components.binary_sensor import (
|
||||
PLATFORM_SCHEMA,
|
||||
BinarySensorDeviceClass,
|
||||
BinarySensorEntity,
|
||||
)
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.core import HomeAssistant
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
@ -32,7 +36,6 @@ from . import (
|
|||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
DEFAULT_DEVICE_CLASS = "power"
|
||||
DEFAULT_NAME = "Vultr {}"
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
{
|
||||
|
@ -64,7 +67,7 @@ def setup_platform(
|
|||
class VultrBinarySensor(BinarySensorEntity):
|
||||
"""Representation of a Vultr subscription sensor."""
|
||||
|
||||
_attr_device_class = DEFAULT_DEVICE_CLASS
|
||||
_attr_device_class = BinarySensorDeviceClass.POWER
|
||||
|
||||
def __init__(self, vultr, subscription, name):
|
||||
"""Initialize a new Vultr binary sensor."""
|
||||
|
|
|
@ -47,7 +47,7 @@ SENSOR_TYPES: dict[str, SensorEntityDescription] = {
|
|||
),
|
||||
SENSOR_MOISTURE: SensorEntityDescription(
|
||||
key=SENSOR_MOISTURE,
|
||||
device_class=SENSOR_MOISTURE,
|
||||
device_class=SensorDeviceClass.MOISTURE,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
),
|
||||
SENSOR_LIGHT: SensorEntityDescription(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue