mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Remove deprecated attributes from ping binary sensor (#125760)
This commit is contained in:
parent
2db488b7a4
commit
f6cf23a8c2
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from homeassistant.components.binary_sensor import (
|
from homeassistant.components.binary_sensor import (
|
||||||
BinarySensorDeviceClass,
|
BinarySensorDeviceClass,
|
||||||
BinarySensorEntity,
|
BinarySensorEntity,
|
||||||
@ -17,11 +15,6 @@ from .const import CONF_IMPORTED_BY
|
|||||||
from .coordinator import PingUpdateCoordinator
|
from .coordinator import PingUpdateCoordinator
|
||||||
from .entity import PingEntity
|
from .entity import PingEntity
|
||||||
|
|
||||||
ATTR_ROUND_TRIP_TIME_AVG = "round_trip_time_avg"
|
|
||||||
ATTR_ROUND_TRIP_TIME_MAX = "round_trip_time_max"
|
|
||||||
ATTR_ROUND_TRIP_TIME_MDEV = "round_trip_time_mdev"
|
|
||||||
ATTR_ROUND_TRIP_TIME_MIN = "round_trip_time_min"
|
|
||||||
|
|
||||||
|
|
||||||
async def async_setup_entry(
|
async def async_setup_entry(
|
||||||
hass: HomeAssistant, entry: PingConfigEntry, async_add_entities: AddEntitiesCallback
|
hass: HomeAssistant, entry: PingConfigEntry, async_add_entities: AddEntitiesCallback
|
||||||
@ -53,13 +46,3 @@ class PingBinarySensor(PingEntity, BinarySensorEntity):
|
|||||||
def is_on(self) -> bool:
|
def is_on(self) -> bool:
|
||||||
"""Return true if the binary sensor is on."""
|
"""Return true if the binary sensor is on."""
|
||||||
return self.coordinator.data.is_alive
|
return self.coordinator.data.is_alive
|
||||||
|
|
||||||
@property
|
|
||||||
def extra_state_attributes(self) -> dict[str, Any] | None:
|
|
||||||
"""Return the state attributes of the ICMP checo request."""
|
|
||||||
return {
|
|
||||||
ATTR_ROUND_TRIP_TIME_AVG: self.coordinator.data.data.get("avg"),
|
|
||||||
ATTR_ROUND_TRIP_TIME_MAX: self.coordinator.data.data.get("max"),
|
|
||||||
ATTR_ROUND_TRIP_TIME_MDEV: self.coordinator.data.data.get("mdev"),
|
|
||||||
ATTR_ROUND_TRIP_TIME_MIN: self.coordinator.data.data.get("min"),
|
|
||||||
}
|
|
||||||
|
@ -36,10 +36,6 @@
|
|||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'device_class': 'connectivity',
|
'device_class': 'connectivity',
|
||||||
'friendly_name': '10.10.10.10',
|
'friendly_name': '10.10.10.10',
|
||||||
'round_trip_time_avg': 4.8,
|
|
||||||
'round_trip_time_max': 10,
|
|
||||||
'round_trip_time_mdev': None,
|
|
||||||
'round_trip_time_min': 1,
|
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'binary_sensor.10_10_10_10',
|
'entity_id': 'binary_sensor.10_10_10_10',
|
||||||
@ -54,10 +50,6 @@
|
|||||||
'attributes': ReadOnlyDict({
|
'attributes': ReadOnlyDict({
|
||||||
'device_class': 'connectivity',
|
'device_class': 'connectivity',
|
||||||
'friendly_name': '10.10.10.10',
|
'friendly_name': '10.10.10.10',
|
||||||
'round_trip_time_avg': None,
|
|
||||||
'round_trip_time_max': None,
|
|
||||||
'round_trip_time_mdev': None,
|
|
||||||
'round_trip_time_min': None,
|
|
||||||
}),
|
}),
|
||||||
'context': <ANY>,
|
'context': <ANY>,
|
||||||
'entity_id': 'binary_sensor.10_10_10_10',
|
'entity_id': 'binary_sensor.10_10_10_10',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user