Alexa CLI
Control Alexa devices via the command line.
Author: buddyh
Category: Home Automation
Permissions
File read · File write · Network · Exec
Dependencies
- alexa-cli (binary)
- Alexa API (service)
Install
clawhub install buddyh--alexa-cliVerify
clawhub listOverview
Alexa CLI is an OpenClaw skill that provides a command line interface to the unofficial Amazon Alexa API. It allows you to control Alexa devices, query device lists, and perform common actions such as speaking a message or managing playback. The documentation highlights a set of practical commands that let you automate device control and simple routines from the terminal.
What This Skill Is Good For
Use Alexa CLI when you want to automate home assistant tasks or trigger Alexa actions from scripts. It is useful for operations like sending a spoken announcement, turning on a routine, or checking device status in a programmable way. Because it is CLI based, it also fits automation workflows where Alexa actions are triggered by other tools.
Requirements and Authentication
The skill uses the Alexa CLI tool and relies on the unofficial Alexa API. You need to authenticate with your Amazon account to access devices. The documentation notes that login is required and that you should keep credentials secure. Because it is unofficial, API behavior may change, so the skill should be tested before relying on it in production automations.
Core Commands
The skill exposes a set of core commands for device management and control:
- list: Lists Alexa devices associated with the account.
- status: Shows status or basic information for a device.
- speak: Sends a text to speech message to a selected device.
- play and pause: Control media playback on a device.
- volume: Set or adjust device volume.
- routine: Trigger a named Alexa routine.
- do not disturb: Enable or disable do not disturb mode.
These commands make it possible to automate announcements or control playback without opening the Alexa app.
Typical Workflows
A typical workflow is to list devices, choose a target device, and send a spoken announcement. This can be used for reminders or alerts. Another common workflow is to trigger a routine, which can bundle multiple Alexa actions into a single command. For example, you might use a routine to turn on lights and play a briefing.
If you use Alexa for media, the play and pause commands can be used in scripts to control playback based on external triggers. Volume control is useful for ensuring that announcements are audible without manual adjustments.
Device Selection and Targeting
The documentation implies that you should reference devices by name or ID. The list command helps identify available devices and confirm the exact names used by the API. For reliable automation, it is best to reference devices consistently and avoid renaming them frequently.
Safety and Reliability Notes
Because the skill uses an unofficial API, it may be subject to changes. Commands may fail if Amazon updates the API or if authentication tokens expire. For automation, you should implement checks or error handling around the CLI calls.
When using speak or routine commands, remember that these actions will run on real devices. Avoid triggering commands in shared environments unless you have clear control over device selection.
Troubleshooting Tips
- If commands fail, verify that authentication is still valid.
- If a device is missing, run list to refresh the device list.
- If speak does not work, confirm the device name and check that it is online.
- If routines do not trigger, verify the routine name in the Alexa app.
Summary
Alexa CLI provides a command line interface to Alexa devices, enabling basic device control, announcements, playback management, and routine execution. It is useful for automation workflows and scripting, especially when you want to trigger Alexa actions from other systems. With careful device targeting and regular verification of authentication, it can be a reliable tool for home automation tasks.
Example Automation Patterns
One example pattern is using a scheduled task to send a daily spoken summary. You can combine a report generator with the speak command so the output is read aloud on a selected device. Another pattern is to trigger a routine when a CI job finishes or when an alert fires, allowing Alexa to announce system status in a home office. The list and status commands are useful for verifying devices before sending announcements.
Command Sequencing
Because the CLI is scriptable, you can chain commands. For example, you can set volume to a known level, send a spoken message, and then restore the previous volume. This ensures announcements are audible without permanently changing device settings. Similarly, you can pause playback before sending a message, then resume playback once the announcement is complete.
Permissions and Account Scope
The CLI uses the authenticated Amazon account and will only control devices linked to that account. If your household uses multiple accounts, ensure you authenticate with the correct one. If a device is shared, it may appear under a specific account and not be accessible from another. This is why the list command is an important diagnostic step when a device cannot be controlled.
Summary
Alexa CLI is a practical tool for command line control of Alexa devices. It enables listing devices, checking status, speaking messages, controlling playback, adjusting volume, and triggering routines. These capabilities make it useful for automation workflows, especially when you want voice announcements or routine execution triggered by scripts.
