forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add base entity for Airgradient (home-assistant#117135)
- Loading branch information
Showing
2 changed files
with
26 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Base class for AirGradient entities.""" | ||
|
||
from homeassistant.helpers.device_registry import DeviceInfo | ||
from homeassistant.helpers.update_coordinator import CoordinatorEntity | ||
|
||
from .const import DOMAIN | ||
from .coordinator import AirGradientDataUpdateCoordinator | ||
|
||
|
||
class AirGradientEntity(CoordinatorEntity[AirGradientDataUpdateCoordinator]): | ||
"""Defines a base AirGradient entity.""" | ||
|
||
_attr_has_entity_name = True | ||
|
||
def __init__(self, coordinator: AirGradientDataUpdateCoordinator) -> None: | ||
"""Initialize airgradient entity.""" | ||
super().__init__(coordinator) | ||
self._attr_device_info = DeviceInfo( | ||
identifiers={(DOMAIN, coordinator.data.serial_number)}, | ||
model=coordinator.data.model, | ||
manufacturer="AirGradient", | ||
serial_number=coordinator.data.serial_number, | ||
sw_version=coordinator.data.firmware_version, | ||
) |
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