Use state class enums in AsusWrt (#60808)
parent
de792e3af2
commit
7dc2a11ea5
|
@ -5,10 +5,9 @@ from dataclasses import dataclass
|
|||
from numbers import Real
|
||||
|
||||
from homeassistant.components.sensor import (
|
||||
STATE_CLASS_MEASUREMENT,
|
||||
STATE_CLASS_TOTAL_INCREASING,
|
||||
SensorEntity,
|
||||
SensorEntityDescription,
|
||||
SensorStateClass,
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
|
@ -49,14 +48,14 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
key=SENSORS_CONNECTED_DEVICE[0],
|
||||
name="Devices Connected",
|
||||
icon="mdi:router-network",
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=UNIT_DEVICES,
|
||||
),
|
||||
AsusWrtSensorEntityDescription(
|
||||
key=SENSORS_RATES[0],
|
||||
name="Download Speed",
|
||||
icon="mdi:download-network",
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=DATA_RATE_MEGABITS_PER_SECOND,
|
||||
entity_registry_enabled_default=False,
|
||||
factor=125000,
|
||||
|
@ -65,7 +64,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
key=SENSORS_RATES[1],
|
||||
name="Upload Speed",
|
||||
icon="mdi:upload-network",
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
native_unit_of_measurement=DATA_RATE_MEGABITS_PER_SECOND,
|
||||
entity_registry_enabled_default=False,
|
||||
factor=125000,
|
||||
|
@ -74,7 +73,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
key=SENSORS_BYTES[0],
|
||||
name="Download",
|
||||
icon="mdi:download",
|
||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=DATA_GIGABYTES,
|
||||
entity_registry_enabled_default=False,
|
||||
factor=1000000000,
|
||||
|
@ -83,7 +82,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
key=SENSORS_BYTES[1],
|
||||
name="Upload",
|
||||
icon="mdi:upload",
|
||||
state_class=STATE_CLASS_TOTAL_INCREASING,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
native_unit_of_measurement=DATA_GIGABYTES,
|
||||
entity_registry_enabled_default=False,
|
||||
factor=1000000000,
|
||||
|
@ -92,7 +91,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
key=SENSORS_LOAD_AVG[0],
|
||||
name="Load Avg (1m)",
|
||||
icon="mdi:cpu-32-bit",
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
factor=1,
|
||||
|
@ -102,7 +101,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
key=SENSORS_LOAD_AVG[1],
|
||||
name="Load Avg (5m)",
|
||||
icon="mdi:cpu-32-bit",
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
factor=1,
|
||||
|
@ -112,7 +111,7 @@ CONNECTION_SENSORS: tuple[AsusWrtSensorEntityDescription, ...] = (
|
|||
key=SENSORS_LOAD_AVG[2],
|
||||
name="Load Avg (15m)",
|
||||
icon="mdi:cpu-32-bit",
|
||||
state_class=STATE_CLASS_MEASUREMENT,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
factor=1,
|
||||
|
|
Loading…
Reference in New Issue