mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Use SensorDeviceClass.UPTIME in System Monitor (#170084)
This commit is contained in:
@@ -281,8 +281,7 @@ SENSOR_TYPES: dict[str, SysMonitorSensorEntityDescription] = {
|
||||
),
|
||||
"last_boot": SysMonitorSensorEntityDescription(
|
||||
key="last_boot",
|
||||
translation_key="last_boot",
|
||||
device_class=SensorDeviceClass.TIMESTAMP,
|
||||
device_class=SensorDeviceClass.UPTIME,
|
||||
value_fn=lambda entity: entity.coordinator.data.boot_time,
|
||||
add_to_update=lambda entity: ("boot", ""),
|
||||
),
|
||||
|
||||
@@ -73,9 +73,6 @@
|
||||
"ipv6_address": {
|
||||
"name": "IPv6 address {ip_address}"
|
||||
},
|
||||
"last_boot": {
|
||||
"name": "Last boot"
|
||||
},
|
||||
"load_15m": {
|
||||
"name": "Load (15 min)"
|
||||
},
|
||||
|
||||
@@ -146,15 +146,6 @@
|
||||
# name: test_sensor[sensor.system_monitor_ipv6_address_eth1 - state]
|
||||
'unknown'
|
||||
# ---
|
||||
# name: test_sensor[sensor.system_monitor_last_boot - attributes]
|
||||
ReadOnlyDict({
|
||||
'device_class': 'timestamp',
|
||||
'friendly_name': 'System Monitor Last boot',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor[sensor.system_monitor_last_boot - state]
|
||||
'2024-02-24T15:00:00+00:00'
|
||||
# ---
|
||||
# name: test_sensor[sensor.system_monitor_load_15_min - attributes]
|
||||
ReadOnlyDict({
|
||||
'friendly_name': 'System Monitor Load (15 min)',
|
||||
@@ -413,3 +404,12 @@
|
||||
# name: test_sensor[sensor.system_monitor_swap_use - state]
|
||||
'60.0'
|
||||
# ---
|
||||
# name: test_sensor[sensor.system_monitor_uptime - attributes]
|
||||
ReadOnlyDict({
|
||||
'device_class': 'uptime',
|
||||
'friendly_name': 'System Monitor Uptime',
|
||||
})
|
||||
# ---
|
||||
# name: test_sensor[sensor.system_monitor_uptime - state]
|
||||
'2024-02-24T15:00:00+00:00'
|
||||
# ---
|
||||
|
||||
Reference in New Issue
Block a user