mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +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,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
ufp_value="stats.storage.used",
|
ufp_value="stats.storage.used",
|
||||||
|
suggested_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||||
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
ProtectSensorEntityDescription(
|
ProtectSensorEntityDescription(
|
||||||
key="write_rate",
|
key="write_rate",
|
||||||
@ -191,6 +193,8 @@ CAMERA_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
|||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
ufp_value="stats.storage.rate_per_second",
|
ufp_value="stats.storage.rate_per_second",
|
||||||
precision=2,
|
precision=2,
|
||||||
|
suggested_unit_of_measurement=UnitOfDataRate.MEGABYTES_PER_SECOND,
|
||||||
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
ProtectSensorEntityDescription(
|
ProtectSensorEntityDescription(
|
||||||
key="voltage",
|
key="voltage",
|
||||||
@ -280,6 +284,8 @@ CAMERA_DISABLED_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
|||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
ufp_value="stats.rx_bytes",
|
ufp_value="stats.rx_bytes",
|
||||||
|
suggested_unit_of_measurement=UnitOfInformation.MEGABYTES,
|
||||||
|
suggested_display_precision=2,
|
||||||
),
|
),
|
||||||
ProtectSensorEntityDescription(
|
ProtectSensorEntityDescription(
|
||||||
key="stats_tx",
|
key="stats_tx",
|
||||||
@ -290,6 +296,8 @@ CAMERA_DISABLED_SENSORS: tuple[ProtectSensorEntityDescription, ...] = (
|
|||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||||
ufp_value="stats.tx_bytes",
|
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 = (
|
expected_values = (
|
||||||
fixed_now.replace(microsecond=0).isoformat(),
|
fixed_now.replace(microsecond=0).isoformat(),
|
||||||
"100",
|
"0.0001",
|
||||||
"100.0",
|
"0.0001",
|
||||||
"20.0",
|
"20.0",
|
||||||
)
|
)
|
||||||
for index, description in enumerate(CAMERA_SENSORS_WRITE):
|
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.state == expected_values[index]
|
||||||
assert state.attributes[ATTR_ATTRIBUTION] == DEFAULT_ATTRIBUTION
|
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):
|
for index, description in enumerate(CAMERA_DISABLED_SENSORS):
|
||||||
unique_id, entity_id = ids_from_device_description(
|
unique_id, entity_id = ids_from_device_description(
|
||||||
Platform.SENSOR, doorbell, description
|
Platform.SENSOR, doorbell, description
|
||||||
|
Loading…
x
Reference in New Issue
Block a user