1 """Support for HDMI CEC."""
3 from __future__
import annotations
7 from .const
import DOMAIN, EVENT_HDMI_CEC_UNAVAILABLE
9 ATTR_PHYSICAL_ADDRESS =
"physical_address"
11 ATTR_TYPE_ID =
"type_id"
12 ATTR_VENDOR_NAME =
"vendor_name"
13 ATTR_VENDOR_ID =
"vendor_id"
15 ICON_UNKNOWN =
"mdi:help"
16 ICON_AUDIO =
"mdi:speaker"
17 ICON_PLAYER =
"mdi:play"
18 ICON_TUNER =
"mdi:radio"
19 ICON_RECORDER =
"mdi:microphone"
20 ICON_TV =
"mdi:television"
31 """Representation of a HDMI CEC device entity."""
33 _attr_should_poll =
False
36 """Initialize the device."""
46 self.
_device_device.osd_name
is not None
50 self.
_attr_name_attr_name = f
"{self.vendor_name} {self._device.osd_name}"
51 elif self.
_device_device.osd_name
is None:
52 self.
_attr_name_attr_name = f
"{self._device.type_name} {self._logical_address}"
54 self.
_attr_name_attr_name = f
"{self._device.type_name} {self._logical_address} ({self._device.osd_name})"
61 """Register HDMI callbacks after initialization."""
63 self.
hasshass.bus.async_listen(
68 """Device status changed, schedule an update."""
74 """Return the ID of the device's vendor."""
75 return self.
_device_device.vendor_id
79 """Return the name of the device's vendor."""
80 return self.
_device_device.vendor
84 """Return the physical address of device in HDMI network."""
85 return str(self.
_device_device.physical_address)
89 """Return a string representation of the device's type."""
90 return self.
_device_device.type_name
94 """Return the type ID of device."""
99 """Return the state attributes."""
102 state_attr[ATTR_VENDOR_ID] = self.
vendor_idvendor_id
103 state_attr[ATTR_VENDOR_NAME] = self.
vendor_namevendor_name
104 if self.
type_idtype_id
is not None:
105 state_attr[ATTR_TYPE_ID] = self.
type_idtype_id
106 state_attr[ATTR_TYPE] = self.
typetype
def physical_address(self)
def async_added_to_hass(self)
def _update(self, device=None)
def _hdmi_cec_unavailable(self, callback_event)
None __init__(self, device, logical)
def extra_state_attributes(self)
None schedule_update_ha_state(self, bool force_refresh=False)