2023-06-28 07:42:12 +00:00
|
|
|
"""Base entity for the LOQED integration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
2023-08-11 02:04:26 +00:00
|
|
|
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC, DeviceInfo
|
2023-06-28 07:42:12 +00:00
|
|
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
|
|
|
|
|
|
|
from .const import DOMAIN
|
|
|
|
from .coordinator import LoqedDataCoordinator
|
|
|
|
|
|
|
|
|
|
|
|
class LoqedEntity(CoordinatorEntity[LoqedDataCoordinator]):
|
|
|
|
"""Defines a LOQED entity."""
|
|
|
|
|
|
|
|
_attr_has_entity_name = True
|
|
|
|
|
|
|
|
def __init__(self, coordinator: LoqedDataCoordinator) -> None:
|
|
|
|
"""Initialize the LOQED entity."""
|
|
|
|
super().__init__(coordinator=coordinator)
|
|
|
|
|
|
|
|
lock_id = coordinator.lock.id
|
|
|
|
|
|
|
|
self._attr_device_info = DeviceInfo(
|
|
|
|
identifiers={(DOMAIN, lock_id)},
|
|
|
|
manufacturer="LOQED",
|
2023-07-03 01:52:52 +00:00
|
|
|
name=coordinator.device_name,
|
2023-06-28 07:42:12 +00:00
|
|
|
model="Touch Smart Lock",
|
|
|
|
connections={(CONNECTION_NETWORK_MAC, lock_id)},
|
|
|
|
)
|