mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Use DeviceClass and StateClass enums in bbox (#61309)
Co-authored-by: epenet <epenet@users.noreply.github.com>
This commit is contained in:
parent
4c542336d5
commit
a7b631d650
@ -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."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user