mirror of https://github.com/home-assistant/core
30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
"""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
|
|
|
|
|
|
class IntellifireEntity(CoordinatorEntity[IntellifireDataUpdateCoordinator]):
|
|
"""Define a generic class for IntelliFire entities."""
|
|
|
|
_attr_attribution = "Data provided by unpublished Intellifire API"
|
|
_attr_has_entity_name = True
|
|
|
|
def __init__(
|
|
self,
|
|
coordinator: IntellifireDataUpdateCoordinator,
|
|
description: EntityDescription,
|
|
) -> None:
|
|
"""Class initializer."""
|
|
super().__init__(coordinator=coordinator)
|
|
self.entity_description = description
|
|
self._attr_unique_id = f"{description.key}_{coordinator.fireplace.serial}"
|
|
self.identifiers = ({("IntelliFire", f"{coordinator.fireplace.serial}]")},)
|
|
|
|
# Configure the Device Info
|
|
self._attr_device_info = self.coordinator.device_info
|