Home Assistant Unofficial Reference 2024.12.1
entity.py
Go to the documentation of this file.
1 """Support for Lutron Homeworks Series 4 and 8 systems."""
2 
3 from __future__ import annotations
4 
5 from pyhomeworks.pyhomeworks import Homeworks
6 
7 from homeassistant.helpers.entity import Entity
8 
9 from .util import calculate_unique_id
10 
11 
13  """Base class of a Homeworks device."""
14 
15  _attr_has_entity_name = True
16  _attr_should_poll = False
17 
18  def __init__(
19  self,
20  controller: Homeworks,
21  controller_id: str,
22  addr: str,
23  idx: int,
24  name: str | None,
25  ) -> None:
26  """Initialize Homeworks device."""
27  self._addr_addr = addr
28  self._idx_idx = idx
29  self._controller_id_controller_id = controller_id
30  self._attr_name_attr_name = name
31  self._attr_unique_id_attr_unique_id = calculate_unique_id(
32  self._controller_id_controller_id, self._addr_addr, self._idx_idx
33  )
34  self._controller_controller = controller
35  self._attr_extra_state_attributes_attr_extra_state_attributes = {"homeworks_address": self._addr_addr}
None __init__(self, Homeworks controller, str controller_id, str addr, int idx, str|None name)
Definition: entity.py:25
str calculate_unique_id(str controller_id, str addr, int idx)
Definition: util.py:4