2023-04-13 03:23:20 +00:00
|
|
|
"""VoIP entities."""
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
2023-04-17 02:59:05 +00:00
|
|
|
from homeassistant.helpers import entity
|
2023-04-13 03:23:20 +00:00
|
|
|
|
|
|
|
from .const import DOMAIN
|
2023-04-17 02:59:05 +00:00
|
|
|
from .devices import VoIPDevice
|
2023-04-13 03:23:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
class VoIPEntity(entity.Entity):
|
|
|
|
"""VoIP entity."""
|
|
|
|
|
|
|
|
_attr_has_entity_name = True
|
|
|
|
_attr_should_poll = False
|
|
|
|
|
2023-04-17 02:59:05 +00:00
|
|
|
def __init__(self, device: VoIPDevice) -> None:
|
2023-04-13 03:23:20 +00:00
|
|
|
"""Initialize VoIP entity."""
|
2023-04-17 02:59:05 +00:00
|
|
|
self._device = device
|
|
|
|
self._attr_unique_id = f"{device.voip_id}-{self.entity_description.key}"
|
2023-04-13 03:23:20 +00:00
|
|
|
self._attr_device_info = entity.DeviceInfo(
|
2023-04-17 02:59:05 +00:00
|
|
|
identifiers={(DOMAIN, device.voip_id)},
|
2023-04-13 03:23:20 +00:00
|
|
|
)
|