Use DataRate unit and device class in integrations (#83610)
This commit is contained in:
parent
3970da0ad3
commit
535aba10ee
21 changed files with 132 additions and 111 deletions
|
@ -27,14 +27,13 @@ from homeassistant.components.sensor import (
|
|||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import (
|
||||
DATA_BYTES,
|
||||
DATA_RATE_BYTES_PER_SECOND,
|
||||
DATA_RATE_MEGABITS_PER_SECOND,
|
||||
ELECTRIC_POTENTIAL_VOLT,
|
||||
LIGHT_LUX,
|
||||
PERCENTAGE,
|
||||
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||
TEMP_CELSIUS,
|
||||
TIME_SECONDS,
|
||||
UnitOfDataRate,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
|
@ -140,7 +139,8 @@ ALL_DEVICES_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
|||
ProtectSensorEntityDescription(
|
||||
key="phy_rate",
|
||||
name="Link Speed",
|
||||
native_unit_of_measurement=DATA_RATE_MEGABITS_PER_SECOND,
|
||||
device_class=SensorDeviceClass.DATA_RATE,
|
||||
native_unit_of_measurement=UnitOfDataRate.MEGABITS_PER_SECOND,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
entity_registry_enabled_default=False,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
|
@ -180,7 +180,8 @@ CAMERA_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
|||
ProtectSensorEntityDescription(
|
||||
key="write_rate",
|
||||
name="Disk Write Rate",
|
||||
native_unit_of_measurement=DATA_RATE_BYTES_PER_SECOND,
|
||||
device_class=SensorDeviceClass.DATA_RATE,
|
||||
native_unit_of_measurement=UnitOfDataRate.BYTES_PER_SECOND,
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
ufp_value="stats.storage.rate_per_second",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue