Skip to content

CLI Reference

Daniel Heinen edited this page May 9, 2026 · 1 revision

CLI Reference

ankerctl.py is a Click-based command-line tool. The general form is:

./ankerctl.py [global options] <group> <subcommand> [options] [arguments]

For inline help on any group or command, append -h or --help:

./ankerctl.py --help
./ankerctl.py mqtt --help
./ankerctl.py mqtt gcode-dump --help

Global options

Flag Description
-p INDEX, --printer-index INDEX Select printer by index (0-based, default 0)
-k, --insecure Disable TLS certificate verification (debugging only)
-v, --verbose Increase log verbosity (repeatable)
-q, --quiet Decrease log verbosity (repeatable)
--pppp-dump FILE Write all PPPP packets to FILE
--mqtt-ca-cert FILE Pin a custom CA certificate for the MQTT broker

config — account and credential management

config import [PATH]

Import account data from a cached login source. When PATH is omitted the importer auto-detects:

  • login.json (legacy AnkerMake desktop)
  • user_info (legacy Windows)
  • .ldb files in the eufyMake Studio LevelDB cache (Windows; eufyMake Studio must be open and signed in)

Examples:

./ankerctl.py config import                       # auto-detect
./ankerctl.py config import path/to/login.json    # explicit
./ankerctl.py config import "%APPDATA%\Roaming\eufyMake Studio Profile\cache\offline\user_info"

config login [COUNTRY]

Fetch account and printer data directly from the AnkerMake servers. Prompts interactively for email and password. If a CAPTCHA is required, the CLI opens it in your browser and asks for the answer.

./ankerctl.py config login DE
./ankerctl.py config login US

config show

Display the current configuration with sensitive fields (user_id, auth_token, mqtt_key) redacted.

config set-password [KEY]

Set the API key used for write-operation auth. Without an argument a random key is generated and printed once — copy it immediately.

./ankerctl.py config set-password                 # random
./ankerctl.py config set-password my-secret-key   # specific

config remove-password

Remove the stored API key. Authentication is disabled (unless ANKERCTL_API_KEY is set in the environment).

config decode [PATH]

Decode and dump the contents of a login.json (or compatible) file without importing. Useful for inspection.

mqtt — encrypted cloud commands

mqtt monitor

Subscribe to all MQTT topics for the selected printer and print every event in real time. Useful as a smoke test and for protocol research.

./ankerctl.py mqtt monitor

mqtt gcode

Open an interactive G-code prompt. Each line you type is sent as a ZZ_MQTT_CMD_GCODE_COMMAND and the printer's reply is printed back.

./ankerctl.py mqtt gcode
> M114
ok X:0.00 Y:0.00 Z:10.00 E:0.00 ...

mqtt gcode-dump GCODE

Send a single G-code, then collect the entire ring-buffer response within a configurable window. Useful for commands like M420 V whose output exceeds a single MQTT packet.

./ankerctl.py mqtt gcode-dump "M420 V"             # default 3.0s window
./ankerctl.py mqtt gcode-dump --window 5 "M503"
./ankerctl.py mqtt gcode-dump --drain 3 "M114"     # send 3 follow-up M114 probes
Option Default Description
--window SECS 3.0 Collect responses for this many seconds
--drain N 0 Send N extra M114 probes after the main response to flush the ring buffer

mqtt rename-printer NAME

Rename the selected printer. The new nickname appears in the AnkerMake / eufyMake mobile app as well.

./ankerctl.py mqtt rename-printer "Workshop M5"

mqtt send <CMD_TYPE> [key=val ...]

Send a raw MQTT command (expert use). CMD_TYPE is the symbolic name from MqttMsgType, e.g. ZZ_MQTT_CMD_PRINT_CONTROL. Additional key=val pairs are added to the payload.

./ankerctl.py mqtt send ZZ_MQTT_CMD_PRINT_CONTROL value=4   # cancel print
./ankerctl.py mqtt send -f ZZ_MQTT_CMD_RECOVER_FACTORY      # safety guard requires --force
Option Description
-f, --force Bypass safety guards (required for destructive commands like RECOVER_FACTORY)

Warning Some commands can brick or factory-reset the printer. Always double-check the CMD_TYPE and value, and only use --force when you understand what you are doing.

pppp — LAN peer-to-peer

pppp lan-search

Broadcast on UDP 255.255.255.255:32108 to find all AnkerMake printers on the local network. Returns DUID, IP, signal quality, and firmware version.

./ankerctl.py pppp lan-search

If discovery hangs and you are on Linux with ufw active, see Firewall ufw.

pppp print-file FILE

Upload a G-code file to the printer over PPPP and start printing.

./ankerctl.py pppp print-file boaty.gcode
./ankerctl.py pppp print-file --no-act boaty.gcode               # upload only
./ankerctl.py pppp print-file --upload-rate-mbps 25 boaty.gcode  # override rate
Option Description
-n, --no-act Upload only, do not start the print
--upload-rate-mbps N Override the upload rate (5, 10, 25, 50, 100)

pppp capture-video [-m SIZE] OUTPUT

Capture raw H.264 video from the printer's built-in camera until SIZE bytes have been written.

./ankerctl.py pppp capture-video -m 4mb output.h264
./ankerctl.py pppp capture-video -m 100mb long.h264

SIZE accepts suffixes: k, m, g (case-insensitive).

http — Anker cloud HTTP utilities

http calc-check-code DUID MAC

Calculate the v1 check code (used by the legacy login flow). Useful for protocol debugging.

./ankerctl.py http calc-check-code EUPRAKM-001234-ABCDE AA:BB:CC:DD:EE:FF

http calc-sec-code DUID MAC

Calculate the v2 security code.

webserver — start the Flask web UI

webserver run

Start the web UI (default http://127.0.0.1:4470).

./ankerctl.py webserver run
./ankerctl.py webserver run --host 0.0.0.0 --port 8080
Option Default Description
--host HOST $FLASK_HOST or 127.0.0.1 Bind address
--port PORT $FLASK_PORT or 4470 Listen port

The web server picks up all environment variables documented in Configuration at startup. To reload them without restarting the whole process, use GET /api/ankerctl/server/reload.

Smoke tests

./ankerctl.py mqtt monitor       # MQTT cloud connectivity
./ankerctl.py pppp lan-search    # local network / PPPP discovery

Common workflows

"Just start the web UI in a tmux"

./ankerctl.py webserver run --host 0.0.0.0 --port 4470

"Send a one-off G-code and capture the full response"

./ankerctl.py mqtt gcode-dump --window 5 "M420 V"

"Print a file from the command line"

./ankerctl.py pppp print-file my.gcode

"Cancel a print without opening the UI"

./ankerctl.py mqtt send ZZ_MQTT_CMD_PRINT_CONTROL value=4

"Diagnose PPPP stalls"

./ankerctl.py --pppp-dump pppp.bin pppp lan-search
# inspect pppp.bin afterwards with examples/demo-pppp.py

"Test a self-hosted MQTT broker (offline mode)"

./ankerctl.py --mqtt-ca-cert /path/to/ca.crt mqtt monitor

See documentation/offline-feasibility.md for the full offline stack design.

Clone this wiki locally