2022-02-12 00:01:38 +00:00
|
|
|
"""Platform for shared base classes for sensors."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
from homeassistant.helpers.entity import EntityDescription
|
|
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
|
|
|
|
from . import IntellifireDataUpdateCoordinator
|
|
|
|
|
|
|
|
|
2022-03-21 13:14:46 +00:00
|
|
|
class IntellifireEntity(CoordinatorEntity[IntellifireDataUpdateCoordinator]):
|
2022-02-12 00:01:38 +00:00
|
|
|
"""Define a generic class for Intellifire entities."""
|
|
|
|
|
|
|
|
_attr_attribution = "Data provided by unpublished Intellifire API"
|
2023-03-13 13:01:28 +00:00
|
|
|
_attr_has_entity_name = True
|
2022-02-12 00:01:38 +00:00
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self,
|
|
|
|
coordinator: IntellifireDataUpdateCoordinator,
|
|
|
|
description: EntityDescription,
|
|
|
|
) -> None:
|
|
|
|
"""Class initializer."""
|
|
|
|
super().__init__(coordinator=coordinator)
|
|
|
|
self.entity_description = description
|
2022-04-21 16:14:13 +00:00
|
|
|
self._attr_unique_id = f"{description.key}_{coordinator.read_api.data.serial}"
|
2022-02-12 00:01:38 +00:00
|
|
|
# Configure the Device Info
|
|
|
|
self._attr_device_info = self.coordinator.device_info
|