mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 18:57:06 +00:00
Expose ping drop rate Starlink sensor (#91444)
This commit is contained in:
parent
1dc0870163
commit
00191ace6c
@ -12,7 +12,13 @@ from homeassistant.components.sensor import (
|
|||||||
SensorStateClass,
|
SensorStateClass,
|
||||||
)
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import DEGREE, EntityCategory, UnitOfDataRate, UnitOfTime
|
from homeassistant.const import (
|
||||||
|
DEGREE,
|
||||||
|
PERCENTAGE,
|
||||||
|
EntityCategory,
|
||||||
|
UnitOfDataRate,
|
||||||
|
UnitOfTime,
|
||||||
|
)
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.typing import StateType
|
from homeassistant.helpers.typing import StateType
|
||||||
@ -119,4 +125,11 @@ SENSORS: tuple[StarlinkSensorEntityDescription, ...] = (
|
|||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
value_fn=lambda data: now() - timedelta(seconds=data.status["uptime"]),
|
value_fn=lambda data: now() - timedelta(seconds=data.status["uptime"]),
|
||||||
),
|
),
|
||||||
|
StarlinkSensorEntityDescription(
|
||||||
|
key="ping_drop_rate",
|
||||||
|
name="Ping Drop Rate",
|
||||||
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
native_unit_of_measurement=PERCENTAGE,
|
||||||
|
value_fn=lambda data: data.status["pop_ping_drop_rate"],
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user