mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 17:27:52 +00:00
Add some suggested units to unifiprotect sensors (#119790)
This commit is contained in:
parent
affbc30d0d
commit
85ca6f15be
@ -181,6 +181,8 @@ CAMERA_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
ufp_value="stats.storage.used",
|
||||
suggested_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
ProtectSensorEntityDescription(
|
||||
key="write_rate",
|
||||
@ -191,6 +193,8 @@ CAMERA_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
||||
state_class=SensorStateClass.MEASUREMENT,
|
||||
ufp_value="stats.storage.rate_per_second",
|
||||
precision=2,
|
||||
suggested_unit_of_measurement=UnitOfDataRate.MEGABYTES_PER_SECOND,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
ProtectSensorEntityDescription(
|
||||
key="voltage",
|
||||
@ -280,6 +284,8 @@ CAMERA_DISABLED_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
ufp_value="stats.rx_bytes",
|
||||
suggested_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
ProtectSensorEntityDescription(
|
||||
key="stats_tx",
|
||||
@ -290,6 +296,8 @@ CAMERA_DISABLED_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
||||
entity_category=EntityCategory.DIAGNOSTIC,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
ufp_value="stats.tx_bytes",
|
||||
suggested_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||
suggested_display_precision=2,
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -327,8 +327,8 @@ async def test_sensor_setup_camera(
|
||||
|
||||
expected_values = (
|
||||
fixed_now.replace(microsecond=0).isoformat(),
|
||||
"100",
|
||||
"100.0",
|
||||
"0.0001",
|
||||
"0.0001",
|
||||
"20.0",
|
||||
)
|
||||
for index, description in enumerate(CAMERA_SENSORS_WRITE):
|
||||
@ -348,7 +348,7 @@ async def test_sensor_setup_camera(
|
||||
assert state.state == expected_values[index]
|
||||
assert state.attributes[ATTR_ATTRIBUTION] == DEFAULT_ATTRIBUTION
|
||||
|
||||
expected_values = ("100", "100")
|
||||
expected_values = ("0.0001", "0.0001")
|
||||
for index, description in enumerate(CAMERA_DISABLED_SENSORS):
|
||||
unique_id, entity_id = ids_from_device_description(
|
||||
Platform.SENSOR, doorbell, description
|
||||
|
Loading…
x
Reference in New Issue
Block a user