DocsIntegrate
The stick command line
How to install the stick host tool, how to choose a device, and a quick reference of common commands grouped by task.
Installation#
stick is Keyling's host tool: a Python command-line program that talks to the device over Wi-Fi. It requires uv on your computer:
winget install astral-sh.uvThere are two ways to get stick.
Install from the device#
The device ships its own install package, so you don't need to clone the repository. The exact file name of the package is listed in http://<device-address>/llms.en.txt.
$dev = "http://192.168.1.50"
$whl = "$dev/sdk/stick-x.y.z-py3-none-any.whl"
uvx --from $whl stick --url $dev infoTyping all of that every time gets long, so you can define a function in PowerShell:
function stick { uvx --from "http://192.168.1.50/sdk/stick-x.y.z-py3-none-any.whl" stick @args }When installed this way, stick keeps its keys and output files under ~/.esp-stick/ in your home directory.
Run from the repository#
Developers who have cloned the repository run this from the repository root:
uv sync --project host
uv run --project host stick --helpKeys are stored in the repository's secrets/devices.json, and output files go to out/. The commands that build and update firmware only work this way; see Build the firmware yourself.
The rest of this page simply writes stick.
Pairing#
You need to pair before first use. The command shows a 4-digit number; when the same number appears on the device screen, click BOOT to allow.
stick --url http://192.168.1.50 pair --wifi--name sets the name shown on the device screen, up to 32 bytes. Pairing is only available in the kernel.
Pairing over the USB serial port writes a new key to the device, and every key issued before it stops working. The kernel has no serial port by default, so switch to the rescue firmware first:
stick boot rescue
stick pair --port COM3
stick boot kernelChoosing a device#
Global options go before the command.
| Option | Effect |
|---|---|
-d <device-id> |
Select by device ID; a unique prefix or suffix is enough |
--url http://192.168.1.50 |
Give the address directly and skip discovery |
--key <64-hex-digits> |
Give the key directly |
--json |
Print a single line of JSON, for scripts and agents |
If you have paired only one device, you can omit all of these. The MCP server stick-mcp also reads the environment variables STICK_DEVICE, STICK_URL and STICK_KEY as defaults; the stick CLI does not read them.
stick lslists the devices found on the local network and the devices you have paired.- On failure, the exit code is 1. With
--json, checkok, and on failure readerror. - Every command has help:
stick <command> --help.
Device#
| Command | Effect |
|---|---|
stick ls |
List devices |
stick info |
Device info: ID, firmware, Wi-Fi, firmware slots |
stick status |
Status snapshot |
stick identify |
Make the device flash for 5 seconds |
stick reboot |
Reboot |
stick snap [out.png] |
Capture the device screen as a PNG |
stick tz [timezone] |
Set the device time zone to this computer's, or to the given IANA time zone; --show only displays it |
stick lang [language] |
Set the device screen language: zh for Chinese, en for English; takes effect immediately. Without an argument, only shows it |
stick button |
BOOT button events; -f follows continuously, --wait waits for the next gesture |
Wi-Fi#
| Command | Effect |
|---|---|
stick wifi |
Remembered networks, up to 3 |
stick wifi-forget MyWiFi |
Forget one network |
Warningstick wifi-forget without a name clears every network; the device goes offline and enters Wi-Fi setup.
Keyboard and mouse#
| Command | Effect |
|---|---|
stick hid |
Output state: armed or not, lease remaining, queue, keys held, reason for the last stop |
stick hid-arm [seconds] |
Arm for 1–600 seconds, 60 by default; calling it again renews the lease |
stick hid-send <actions> |
Send actions; requires arming first. --wait waits until they finish |
stick hid-release |
Release all keys and mouse buttons without disarming |
stick hid-disarm |
Emergency stop: clear the queue, release everything, disarm |
stick hid-play <file> |
Send a binary timeline file; requires arming first |
stick monitor |
Show the monitor screen state; pass JSON to set the right-hand side, --clear to clear it |
Example: arm for 60 seconds and press A once. Open Notepad and bring it to the foreground first.
stick hid-arm 60
'[{"tap":"A"}]' | stick hid-send -
stick hid-disarmThe action JSON is passed on standard input because Windows PowerShell 5.1 strips double quotes from arguments passed to external programs. You can also put it in a file: stick hid-send "@动作.json" (动作 means "actions").
Action syntax:
| Syntax | Meaning |
|---|---|
{"tap":"S","mods":["ctrl"]} |
Tap a key; mods is optional |
{"down":"A"} / {"up":"A"} / {"up":"all"} |
Hold / release |
{"text":"hello\n"} |
Type text: English letters, symbols, newlines and tabs, up to 256 |
{"move":[dx,dy]} |
Relative mouse movement, ±2000 on each axis |
{"click":"left"} |
Mouse click: left right middle back forward |
{"press":"left"} / {"release":"left"} |
Hold / release a mouse button |
{"wheel":-3} |
Scroll wheel notches |
{"media":"volume_up"} |
Media key |
{"wait":100} |
Pause in milliseconds, up to 5000 |
Only the standard 87-key set is accepted by default. --extended enables F13–F24 and NumLock, for self-tests only.
Macros#
| Command | Effect |
|---|---|
stick macro ls |
List macros, the current macro and the player state |
stick macro get <name> [-o file] |
Get a macro's JSON |
stick macro put <file> [--sd] [--force] |
Validate and upload |
stick macro select <name> |
Set as the current macro |
stick macro run [name] |
Run the current macro; with a name, do a test run of that macro |
stick macro stop |
Stop |
stick macro rm <name> |
Delete |
See Macros.
Apps#
| Command | Effect |
|---|---|
stick apps |
App list and running state |
stick push <dir> |
Upload an app directory and start it; returns the start result and logs |
stick start <app-id> / stick stop |
Start / stop the current app |
stick auto <app-id> / stick auto --off |
Set / clear the app that starts on boot |
stick rm-app <app-id> |
Delete an app, keeping its data |
stick try <file.lua> / stick try -e <code> |
Run as a temporary app for a few seconds; returns events, logs and a screenshot |
stick eval <code> |
Run a snippet of Lua inside the current app |
stick msg <JSON> |
Send a message to the current app |
stick events [-f] |
Events emitted by the app |
stick ui |
UI object tree |
See Lua apps.
Files#
| Command | Effect |
|---|---|
stick fs ls [path] |
List a storage directory |
stick fs get <path> [local] |
Download a file |
stick fs put <local> <path> |
Upload a file, up to 2 MB |
stick fs rm <path> [-r] |
Delete |
stick sd ls [path] |
List a microSD card directory |
stick sd get <path> [local] |
Download a file; rerunning after an interruption resumes |
stick sd put <local> <path> |
Upload a file; if the local path is a directory, uploads the whole tree |
stick sd rm <path> [-r] |
Delete |
stick sd play <path> [--wait] |
Have the device play a timeline file from the card; --status shows progress, --stop stops playback |
TipIn Git Bash, run export MSYS_NO_PATHCONV=1 before commands that take device paths such as /stick/...; otherwise the paths are rewritten as Windows paths. PowerShell does not have this problem.
Logs and troubleshooting#
| Command | Effect |
|---|---|
stick logs |
Recent logs; -f follows continuously |
stick logs --boots |
List the boots recorded in the black-box log on the microSD card |
stick logs --boot -1 --tail 100 |
The last 100 lines from the previous boot |
stick crash |
Get the crash dump; --decode needs the ELF from the matching build, so it is for developers only |
All stick output is UTF-8.
Firmware#
| Command | Effect | Notes |
|---|---|---|
stick boot rescue|kernel |
Switch to the rescue firmware or the kernel and reboot | |
stick rollback |
Go back to the other kernel slot | |
stick confirm |
Confirm a pending kernel | |
stick usb hid|serial |
Switch USB mode and reboot | |
stick keygen |
Generate a firmware signing key | Requires the repository |
stick build kernel|rescue |
Build firmware | Requires the repository and ESP-IDF |
stick deploy |
Build and update the kernel over Wi-Fi | Requires the repository and ESP-IDF |
stick usb-flash |
First-time USB flash of the rescue firmware | Requires the repository and ESP-IDF |
stick selftest |
Hardware-layer self-test; presses F13–F24 and moves the cursor | Use after changing firmware |
See Updates and recovery and Build the firmware yourself.
Full reference#
For every option of a command, see stick <command> --help, and host/README.md on GitHub.