mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Add boot time sensor to System Bridge (#73039)
* 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>
This commit is contained in:
parent
9392f59913
commit
46b4be5b41
@ -3,7 +3,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta, timezone
|
||||||
from typing import Final, cast
|
from typing import Final, cast
|
||||||
|
|
||||||
from homeassistant.components.sensor import (
|
from homeassistant.components.sensor import (
|
||||||
@ -125,6 +125,15 @@ def memory_used(data: SystemBridgeCoordinatorData) -> float | None:
|
|||||||
|
|
||||||
|
|
||||||
BASE_SENSOR_TYPES: tuple[SystemBridgeSensorEntityDescription, ...] = (
|
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(
|
SystemBridgeSensorEntityDescription(
|
||||||
key="cpu_speed",
|
key="cpu_speed",
|
||||||
name="CPU Speed",
|
name="CPU Speed",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user