1 """Support the UPB PIM."""
7 from .const
import DOMAIN
11 """Base class for all UPB entities."""
13 _attr_should_poll =
False
16 """Initialize the base of all UPB devices."""
19 element_type =
"link" if element.addr.is_link
else "device"
20 self.
_unique_id_unique_id = f
"{unique_id}_{element_type}_{element.addr}"
24 """Return unique id of the element."""
29 """Return the default attributes of the element."""
30 return self.
_element_element.as_dict()
34 """Is the entity available to be updated."""
42 """Handle callback from an UPB element that has changed."""
47 """Register callback for UPB changes and update entity state."""
53 """Base class for UPB attached entities."""
57 """Device info for the entity."""
59 identifiers={(DOMAIN, self.
_element_element.index)},
60 manufacturer=self.
_element_element.manufacturer,
63 sw_version=self.
_element_element.version,
DeviceInfo device_info(self)
def async_added_to_hass(self)
def _element_changed(self, element, changeset)
def extra_state_attributes(self)
def _element_callback(self, element, changeset)
def __init__(self, element, unique_id, upb)
None async_write_ha_state(self)