1 """Home Assistant integration to control a sky box using the remote platform."""
3 from collections.abc
import Iterable
7 from skyboxremote
import VALID_KEYS, RemoteControl
15 from .
import SkyRemoteConfigEntry
16 from .const
import DOMAIN
18 _LOGGER = logging.getLogger(__name__)
23 config: SkyRemoteConfigEntry,
24 async_add_entities: AddEntitiesCallback,
26 """Set up the Sky remote platform."""
28 [
SkyRemote(config.runtime_data, config.entry_id)],
34 """Representation of a Sky Remote."""
36 _attr_has_entity_name =
True
39 def __init__(self, remote: RemoteControl, unique_id: str) ->
None:
40 """Initialize the Sky Remote."""
44 identifiers={(DOMAIN, unique_id)},
50 def turn_on(self, activity: str |
None =
None, **kwargs: Any) ->
None:
51 """Send the power on command."""
54 def turn_off(self, activity: str |
None =
None, **kwargs: Any) ->
None:
55 """Send the power command."""
58 def send_command(self, command: Iterable[str], **kwargs: Any) ->
None:
59 """Send a list of commands to the device."""
61 if cmd
not in VALID_KEYS:
63 f
"{cmd} is not in Valid Keys: {VALID_KEYS}"
66 self.
_remote_remote.send_keys(command)
67 except ValueError
as err:
68 _LOGGER.error(
"Invalid command: %s. Error: %s", command, err)
70 _LOGGER.debug(
"Successfully sent command %s", command)
None send_command(self, Iterable[str] command, **Any kwargs)
None send_command(self, Iterable[str] command, **Any kwargs)
None __init__(self, RemoteControl remote, str unique_id)
None turn_on(self, str|None activity=None, **Any kwargs)
None turn_off(self, str|None activity=None, **Any kwargs)
None async_setup_entry(HomeAssistant hass, SkyRemoteConfigEntry config, AddEntitiesCallback async_add_entities)