Skip to content

Commit

Permalink
Add boot time sensor to System Bridge (home-assistant#73039)
Browse files Browse the repository at this point in the history
* Add boot time to System Bridge

* Update homeassistant/components/system_bridge/sensor.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

* Add missing import

* Update homeassistant/components/system_bridge/sensor.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Franck Nijhof <frenck@frenck.nl>
  • Loading branch information
3 people authored Jun 29, 2022
1 parent 9392f59 commit 46b4be5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion homeassistant/components/system_bridge/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from collections.abc import Callable
from dataclasses import dataclass
from datetime import datetime, timedelta
from datetime import datetime, timedelta, timezone
from typing import Final, cast

from homeassistant.components.sensor import (
Expand Down Expand Up @@ -125,6 +125,15 @@ def memory_used(data: SystemBridgeCoordinatorData) -> float | None:


BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
SystemBridgeSensorEntityDescription(
key="boot_time",
name="Boot Time",
device_class=SensorDeviceClass.TIMESTAMP,
icon="mdi:av-timer",
value=lambda data: datetime.fromtimestamp(
data.system.boot_time, tz=timezone.utc
),
),
SystemBridgeSensorEntityDescription(
key="cpu_speed",
name="CPU Speed",
Expand Down

0 comments on commit 46b4be5

Please sign in to comment.