mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Address late review for Ping (#112123)
* Address late review for Ping * Fix import
This commit is contained in:
parent
a37c82e34c
commit
911cf60678
@ -95,7 +95,7 @@ class PingBinarySensor(PingEntity, BinarySensorEntity):
|
|||||||
self, config_entry: ConfigEntry, coordinator: PingUpdateCoordinator
|
self, config_entry: ConfigEntry, coordinator: PingUpdateCoordinator
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the Ping Binary sensor."""
|
"""Initialize the Ping Binary sensor."""
|
||||||
super().__init__(coordinator, config_entry.entry_id)
|
super().__init__(config_entry, coordinator, config_entry.entry_id)
|
||||||
|
|
||||||
# if this was imported just enable it when it was enabled before
|
# if this was imported just enable it when it was enabled before
|
||||||
if CONF_IMPORTED_BY in config_entry.data:
|
if CONF_IMPORTED_BY in config_entry.data:
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
"""Base entity for the Ping component."""
|
"""Base entity for the Ping component."""
|
||||||
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.core import DOMAIN
|
from homeassistant.core import DOMAIN
|
||||||
from homeassistant.helpers.device_registry import DeviceInfo
|
from homeassistant.helpers.device_registry import DeviceInfo
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
@ -13,6 +14,7 @@ class PingEntity(CoordinatorEntity[PingUpdateCoordinator]):
|
|||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
config_entry: ConfigEntry,
|
||||||
coordinator: PingUpdateCoordinator,
|
coordinator: PingUpdateCoordinator,
|
||||||
unique_id: str,
|
unique_id: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -21,6 +23,6 @@ class PingEntity(CoordinatorEntity[PingUpdateCoordinator]):
|
|||||||
|
|
||||||
self._attr_unique_id = unique_id
|
self._attr_unique_id = unique_id
|
||||||
self._attr_device_info = DeviceInfo(
|
self._attr_device_info = DeviceInfo(
|
||||||
identifiers={(DOMAIN, self.coordinator.data.ip_address)},
|
identifiers={(DOMAIN, config_entry.entry_id)},
|
||||||
manufacturer="Ping",
|
manufacturer="Ping",
|
||||||
)
|
)
|
||||||
|
@ -101,7 +101,9 @@ class PingSensor(PingEntity, SensorEntity):
|
|||||||
coordinator: PingUpdateCoordinator,
|
coordinator: PingUpdateCoordinator,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
super().__init__(coordinator, f"{config_entry.entry_id}-{description.key}")
|
super().__init__(
|
||||||
|
config_entry, coordinator, f"{config_entry.entry_id}-{description.key}"
|
||||||
|
)
|
||||||
|
|
||||||
self.entity_description = description
|
self.entity_description = description
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user