-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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 in Switcher (#126822)
- Loading branch information
Showing
6 changed files
with
31 additions
and
55 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
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,20 @@ | ||
"""Base class for Switcher entities.""" | ||
|
||
from homeassistant.helpers import device_registry as dr | ||
from homeassistant.helpers.device_registry import DeviceInfo | ||
from homeassistant.helpers.update_coordinator import CoordinatorEntity | ||
|
||
from .coordinator import SwitcherDataUpdateCoordinator | ||
|
||
|
||
class SwitcherEntity(CoordinatorEntity[SwitcherDataUpdateCoordinator]): | ||
"""Base class for Switcher entities.""" | ||
|
||
_attr_has_entity_name = True | ||
|
||
def __init__(self, coordinator: SwitcherDataUpdateCoordinator) -> None: | ||
"""Initialize the entity.""" | ||
super().__init__(coordinator) | ||
self._attr_device_info = DeviceInfo( | ||
connections={(dr.CONNECTION_NETWORK_MAC, coordinator.mac_address)} | ||
) |
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