-
-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce base entity for ping (#104197)
- Loading branch information
Showing
6 changed files
with
111 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""Base entity for Ping integration.""" | ||
from homeassistant.config_entries import ConfigEntry | ||
from homeassistant.helpers.device_registry import DeviceInfo | ||
from homeassistant.helpers.update_coordinator import CoordinatorEntity | ||
|
||
from .const import DOMAIN | ||
from .coordinator import PingUpdateCoordinator | ||
|
||
|
||
class BasePingEntity(CoordinatorEntity[PingUpdateCoordinator]): | ||
"""Representation of a Ping base entity.""" | ||
|
||
_attr_has_entity_name = True | ||
_attr_name = None | ||
|
||
def __init__( | ||
self, config_entry: ConfigEntry, coordinator: PingUpdateCoordinator | ||
) -> None: | ||
"""Initialize the Ping Binary sensor.""" | ||
super().__init__(coordinator) | ||
|
||
self._attr_unique_id = config_entry.entry_id | ||
self._attr_device_info = DeviceInfo( | ||
identifiers={(DOMAIN, self.coordinator.data.ip_address)}, | ||
manufacturer="Ping", | ||
) | ||
|
||
self.config_entry = config_entry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters