Home Assistant Unofficial Reference 2024.12.1
entity.py
Go to the documentation of this file.
1 """Entity representing a Netgear LTE entity."""
2 
3 from homeassistant.const import CONF_HOST
4 from homeassistant.helpers.device_registry import DeviceInfo
5 from homeassistant.helpers.entity import EntityDescription
6 from homeassistant.helpers.update_coordinator import CoordinatorEntity
7 
8 from . import NetgearLTEConfigEntry
9 from .const import DOMAIN, MANUFACTURER
10 from .coordinator import NetgearLTEDataUpdateCoordinator
11 
12 
13 class LTEEntity(CoordinatorEntity[NetgearLTEDataUpdateCoordinator]):
14  """Base LTE entity."""
15 
16  _attr_has_entity_name = True
17 
18  def __init__(
19  self,
20  entry: NetgearLTEConfigEntry,
21  description: EntityDescription,
22  ) -> None:
23  """Initialize a Netgear LTE entity."""
24  super().__init__(entry.runtime_data)
25  self.entity_descriptionentity_description = description
26  data = entry.runtime_data.data
27  self._attr_unique_id_attr_unique_id = f"{description.key}_{data.serial_number}"
28  self._attr_device_info_attr_device_info = DeviceInfo(
29  configuration_url=f"http://{entry.data[CONF_HOST]}",
30  identifiers={(DOMAIN, data.serial_number)},
31  manufacturer=MANUFACTURER,
32  model=data.items["general.model"],
33  serial_number=data.serial_number,
34  sw_version=data.items["general.fwversion"],
35  hw_version=data.items["general.hwversion"],
36  )
None __init__(self, NetgearLTEConfigEntry entry, EntityDescription description)
Definition: entity.py:22