forked from home-assistant/core
-
Notifications
You must be signed in to change notification settings - Fork 1
/
entity.py
28 lines (22 loc) · 1.03 KB
/
entity.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""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):
"""Define a generic class for Intellifire entities."""
coordinator: IntellifireDataUpdateCoordinator
_attr_attribution = "Data provided by unpublished Intellifire API"
def __init__(
self,
coordinator: IntellifireDataUpdateCoordinator,
description: EntityDescription,
) -> None:
"""Class initializer."""
super().__init__(coordinator=coordinator)
self.entity_description = description
# Set the Display name the User will see
self._attr_name = f"Fireplace {description.name}"
self._attr_unique_id = f"{description.key}_{coordinator.api.data.serial}"
# Configure the Device Info
self._attr_device_info = self.coordinator.device_info