Use DeviceClass and StateClass enums in bbox (#61309)

Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
epenet 2021-12-09 09:12:54 +01:00 committed by GitHub
parent 4c542336d5
commit a7b631d650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,15 +10,15 @@ import voluptuous as vol
from homeassistant.components.sensor import (
PLATFORM_SCHEMA,
STATE_CLASS_MEASUREMENT,
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
)
from homeassistant.const import (
CONF_MONITORED_VARIABLES,
CONF_NAME,
DATA_RATE_MEGABITS_PER_SECOND,
DEVICE_CLASS_TIMESTAMP,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle
@ -49,14 +49,14 @@ SENSOR_TYPES: tuple[SensorEntityDescription, ...] = (
key="current_down_bandwidth",
name="Currently Used Download Bandwidth",
native_unit_of_measurement=DATA_RATE_MEGABITS_PER_SECOND,
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:download",
),
SensorEntityDescription(
key="current_up_bandwidth",
name="Currently Used Upload Bandwidth",
native_unit_of_measurement=DATA_RATE_MEGABITS_PER_SECOND,
state_class=STATE_CLASS_MEASUREMENT,
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:upload",
),
SensorEntityDescription(
@ -120,7 +120,7 @@ class BboxUptimeSensor(SensorEntity):
"""Bbox uptime sensor."""
_attr_attribution = ATTRIBUTION
_attr_device_class = DEVICE_CLASS_TIMESTAMP
_attr_device_class = SensorDeviceClass.TIMESTAMP
def __init__(self, bbox_data, name, description: SensorEntityDescription):
"""Initialize the sensor."""