Home Assistant Unofficial Reference 2024.12.1
entity.py
Go to the documentation of this file.
1 """The PEGELONLINE base entity."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo
6 from homeassistant.helpers.update_coordinator import CoordinatorEntity
7 
8 from .const import DOMAIN
9 from .coordinator import PegelOnlineDataUpdateCoordinator
10 
11 
12 class PegelOnlineEntity(CoordinatorEntity[PegelOnlineDataUpdateCoordinator]):
13  """Representation of a PEGELONLINE entity."""
14 
15  _attr_has_entity_name = True
16  _attr_available = True
17 
18  def __init__(self, coordinator: PegelOnlineDataUpdateCoordinator) -> None:
19  """Initialize a PEGELONLINE entity."""
20  super().__init__(coordinator)
21  self.stationstationstation = coordinator.station
22  self._attr_extra_state_attributes_attr_extra_state_attributes = {}
23 
24  @property
25  def device_info(self) -> DeviceInfo:
26  """Return the device information of the entity."""
27  return DeviceInfo(
28  identifiers={(DOMAIN, self.stationstationstation.uuid)},
29  name=f"{self.station.name} {self.station.water_name}",
30  manufacturer=self.stationstationstation.agency,
31  configuration_url=self.stationstationstation.base_data_url,
32  entry_type=DeviceEntryType.SERVICE,
33  )
None __init__(self, PegelOnlineDataUpdateCoordinator coordinator)
Definition: entity.py:18