diff --git a/homeassistant/components/systemmonitor/sensor.py b/homeassistant/components/systemmonitor/sensor.py index 4a4703235d3..37059307ef2 100644 --- a/homeassistant/components/systemmonitor/sensor.py +++ b/homeassistant/components/systemmonitor/sensor.py @@ -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", ""), ), diff --git a/homeassistant/components/systemmonitor/strings.json b/homeassistant/components/systemmonitor/strings.json index 6041dc02c08..97f8f16af84 100644 --- a/homeassistant/components/systemmonitor/strings.json +++ b/homeassistant/components/systemmonitor/strings.json @@ -73,9 +73,6 @@ "ipv6_address": { "name": "IPv6 address {ip_address}" }, - "last_boot": { - "name": "Last boot" - }, "load_15m": { "name": "Load (15 min)" }, diff --git a/tests/components/systemmonitor/snapshots/test_sensor.ambr b/tests/components/systemmonitor/snapshots/test_sensor.ambr index 4bcc0010f24..53ae7dec44c 100644 --- a/tests/components/systemmonitor/snapshots/test_sensor.ambr +++ b/tests/components/systemmonitor/snapshots/test_sensor.ambr @@ -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' +# ---