home-assistant/core · error · ValueError
Command not found. Exiting sequence
Error message
Command not found. Exiting sequence
What it means
ValueError('Command not found. Exiting sequence') raised by the apple_tv remote send_command handling when a command name in the sequence resolves to no callable. It first tries COMMAND_TO_ATTRIBUTE chained attribute lookup on the pyatv interface, then falls back to getattr(self.atv.remote_control, name); if both yield nothing, the sequence aborts immediately at that command.
Source
Thrown at homeassistant/components/apple_tv/remote.py:93
num_repeats = kwargs[ATTR_NUM_REPEATS]
delay = kwargs.get(ATTR_DELAY_SECS, DEFAULT_DELAY_SECS)
hold_secs = kwargs.get(ATTR_HOLD_SECS, DEFAULT_HOLD_SECS)
if not self.atv:
_LOGGER.error("Unable to send commands, not connected to %s", self.name)
return
for _ in range(num_repeats):
for single_command in command:
attr_value: Any = None
if attributes := COMMAND_TO_ATTRIBUTE.get(single_command):
attr_value = self.atv
for attr_name in attributes:
attr_value = getattr(attr_value, attr_name, None)
if not attr_value:
attr_value = getattr(self.atv.remote_control, single_command, None)
if not attr_value:
raise ValueError("Command not found. Exiting sequence")
_LOGGER.debug("Sending command %s", single_command)
if hold_secs >= 1:
await attr_value(action=InputAction.Hold)
else:
await attr_value()
await asyncio.sleep(delay)
View on GitHub (pinned to 58a3fdb3ea)
Solutions
- Use a valid pyatv remote control key name (e.g. 'menu', 'home', 'up', 'select', 'play_pause'); list them via 'atvremote ... command' or the pyatv docs
- Fix the typo in the YAML sequence/dashboard button
- If the key should exist, upgrade pyatv/apple_tv integration to a version that supports it
Example fix
# before
data: {command: ["hom", "select"]}
# after
data: {command: ["home", "select"]} Defensive patterns
Strategy: validation
Validate before calling
KNOWN = {"menu", "home", "up", "down", "left", "right", "select", "play_pause"}
seq = [c for c in command if c in KNOWN]
if len(seq) != len(command):
raise ValueError(f"unknown keys: {set(command) - KNOWN}") Prevention
- Keep a project-level list of supported remote keys and lint sequences against it
- Test sequences in Developer Tools before embedding in automations
- After pyatv upgrades, re-verify key names
When it happens
Trigger: Sending 'send_command' with a key name that is neither a mapped multi-attribute path nor an attribute of pyatv's remote_control: typos like 'updown', renamed keys across pyatv versions, or device-specific keys the interface does not expose.
Common situations: Remote card sequences or scripts with mistyped key names; pyatv upgrade renaming/removing a RemoteKey; custom key names for newer Siri Remote buttons not present in the installed pyatv version.
Related errors
- {address}: Authentication failed, try reconfiguring device:
- streaming_not_supported
- stream_failed
- keyboard_not_available
- keyboard_error
AI-assisted analysis of home-assistant/core@58a3fdb3ea (2026-08-14).
Data as JSON: /api/errors/469107a0ea916fd3.
Report an issue: GitHub.