Home Assistant Unofficial Reference 2024.12.1
entity.py
Go to the documentation of this file.
1 """Generic entity for the WMS WebControl pro API integration."""
2 
3 from __future__ import annotations
4 
5 from wmspro.destination import Destination
6 
7 from homeassistant.helpers.device_registry import DeviceInfo
8 from homeassistant.helpers.entity import Entity
9 
10 from .const import ATTRIBUTION, DOMAIN, MANUFACTURER
11 
12 
14  """Foundation of all WMS based entities."""
15 
16  _attr_attribution = ATTRIBUTION
17  _attr_has_entity_name = True
18  _attr_name = None
19 
20  def __init__(self, config_entry_id: str, dest: Destination) -> None:
21  """Initialize the entity with destination channel."""
22  dest_id_str = str(dest.id)
23  self._dest_dest = dest
24  self._attr_unique_id_attr_unique_id = dest_id_str
25  self._attr_device_info_attr_device_info = DeviceInfo(
26  identifiers={(DOMAIN, dest_id_str)},
27  manufacturer=MANUFACTURER,
28  model=dest.animationType.name,
29  name=dest.name,
30  serial_number=dest_id_str,
31  suggested_area=dest.room.name,
32  via_device=(DOMAIN, config_entry_id),
33  configuration_url=f"http://{dest.host}/control",
34  )
35 
36  async def async_update(self) -> None:
37  """Update the entity."""
38  await self._dest_dest.refresh()
39 
40  @property
41  def available(self) -> bool:
42  """Return if entity is available."""
43  return self._dest_dest.available
None __init__(self, str config_entry_id, Destination dest)
Definition: entity.py:20