1 """Remote control support for Panasonic Viera TV."""
3 from __future__
import annotations
5 from collections.abc
import Iterable
30 config_entry: ConfigEntry,
31 async_add_entities: AddEntitiesCallback,
33 """Set up Panasonic Viera TV Remote from a config entry."""
35 config = config_entry.data
37 remote = hass.data[DOMAIN][config_entry.entry_id][ATTR_REMOTE]
38 name = config[CONF_NAME]
39 device_info = config[ATTR_DEVICE_INFO]
45 """Representation of a Panasonic Viera TV Remote."""
48 self, remote: Remote, name: str, device_info: dict[str, Any] |
None =
None
50 """Initialize the entity."""
58 """Return the unique ID of the device."""
65 """Return device specific attributes."""
69 identifiers={(DOMAIN, self.
_device_info_device_info[ATTR_UDN])},
70 manufacturer=self.
_device_info_device_info.
get(ATTR_MANUFACTURER, DEFAULT_MANUFACTURER),
71 model=self.
_device_info_device_info.
get(ATTR_MODEL_NUMBER, DEFAULT_MODEL_NUMBER),
77 """Return the name of the device."""
78 return self.
_name_name
82 """Return True if the device is available."""
83 return self.
_remote_remote.available
87 """Return true if device is on."""
88 return self.
_remote_remote.state == STATE_ON
91 """Turn the device on."""
95 """Turn the device off."""
99 """Send a command to one device."""
101 await self.
_remote_remote.async_send_key(cmd)
None async_turn_off(self, **Any kwargs)
None async_send_command(self, Iterable[str] command, **Any kwargs)
DeviceInfo|None device_info(self)
None __init__(self, Remote remote, str name, dict[str, Any]|None device_info=None)
None async_turn_on(self, **Any kwargs)
web.Response get(self, web.Request request, str config_key)
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)