2023-09-27 05:04:20 +00:00
|
|
|
"""Base entity for poolsense integration."""
|
2024-03-08 14:04:07 +00:00
|
|
|
|
2023-09-27 05:04:20 +00:00
|
|
|
from homeassistant.helpers.entity import EntityDescription
|
|
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
|
|
|
|
from .const import ATTRIBUTION
|
2023-09-27 08:14:51 +00:00
|
|
|
from .coordinator import PoolSenseDataUpdateCoordinator
|
2023-09-27 05:04:20 +00:00
|
|
|
|
|
|
|
|
2023-09-27 08:14:51 +00:00
|
|
|
class PoolSenseEntity(CoordinatorEntity[PoolSenseDataUpdateCoordinator]):
|
2023-09-27 05:04:20 +00:00
|
|
|
"""Implements a common class elements representing the PoolSense component."""
|
|
|
|
|
|
|
|
_attr_attribution = ATTRIBUTION
|
|
|
|
|
2023-09-27 08:14:51 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
coordinator: PoolSenseDataUpdateCoordinator,
|
|
|
|
email: str,
|
|
|
|
description: EntityDescription,
|
|
|
|
) -> None:
|
2023-09-27 05:04:20 +00:00
|
|
|
"""Initialize poolsense sensor."""
|
|
|
|
super().__init__(coordinator)
|
|
|
|
self.entity_description = description
|
|
|
|
self._attr_name = f"PoolSense {description.name}"
|
|
|
|
self._attr_unique_id = f"{email}-{description.key}"
|