Remove deprecated attributes from ping binary sensor (#125760)

This commit is contained in:
Jan-Philipp Benecke 2024-09-11 16:17:20 +02:00 committed by GitHub
parent 2db488b7a4
commit f6cf23a8c2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 0 additions and 25 deletions

View File

@ -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"),
}

View File

@ -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',