Snapmaker
by @odrobnik
Control and monitor Snapmaker 2.0 3D printers via their HTTP API. Status, job management, progress watching, and event monitoring.
clawhub install snapmaker-2π About This Skill
name: snapmaker-2 description: "Control and monitor Snapmaker 2.0 3D printers via their HTTP API. Status, job management, progress watching, and event monitoring." summary: "Snapmaker 2.0 3D printer control: status, jobs, monitoring." version: 1.2.2 homepage: https://github.com/odrobnik/snapmaker-skill metadata: { "openclaw": { "emoji": "π¨οΈ", "requires": { "bins": ["python3"] }, }, }
Snapmaker 2.0 Skill
Control and monitor Snapmaker 2.0 3D printers via their HTTP API.
Features
Configuration
Create config.json in your workspace's snapmaker/ folder (e.g. ~/clawd/snapmaker/config.json).
Start from config.json.example.
Config format:
{
"ip": "192.168.0.32",
"token": "your-token-here",
"port": 8080
}
Finding your token:
Open the Snapmaker Luban app, connect to your printer, and find the token
in the connection settings. Copy it into your config.json.
Usage
Discovery
# Find Snapmaker printers on the local network (UDP broadcast, port 20054)
python3 scripts/snapmaker.py discoverProbe a specific IP (useful across subnets)
python3 scripts/snapmaker.py discover --target 192.168.0.32JSON output
python3 scripts/snapmaker.py discover --json
Discovery uses the Snapmaker UDP broadcast protocol (no auth required). Falls back to HTTP probe using config if UDP gets no reply (e.g. different subnet).
Basic Commands
# Get current printer status
python3 scripts/snapmaker.py statusWatch print progress (updates every 5 seconds)
python3 scripts/snapmaker.py watchGet status as JSON
python3 scripts/snapmaker.py status --json
Job Control
# Send a file (prepares but doesn't start)
python3 scripts/snapmaker.py send ~/prints/model.gcodeSend and start immediately
python3 scripts/snapmaker.py send ~/prints/model.gcode --start --yesPause current print
python3 scripts/snapmaker.py pause --yesResume paused print
python3 scripts/snapmaker.py resume --yesStop/cancel print (requires confirmation)
python3 scripts/snapmaker.py stop
Safety Flags
--yes - Skip confirmation prompts (use with caution!)--force - Override safety checks (NOT RECOMMENDED)All commands that modify state require confirmation unless --yes is provided.
API Endpoints
The skill uses these Snapmaker HTTP API v1 endpoints:
POST /api/v1/connect - Establish connectionGET /api/v1/status - Get printer statusPOST /api/v1/prepare_print - Upload filePOST /api/v1/start_print - Start printingPOST /api/v1/pause - Pause printPOST /api/v1/resume - Resume printPOST /api/v1/stop - Stop/cancel printGET /api/v1/print_file - Download last fileStatus Fields
The status command returns:
Notifications
To detect events:
# Watch for completion
python3 scripts/snapmaker.py watchOr poll status in a loop
while true; do
python3 scripts/snapmaker.py status --json | jq -r '.printStatus'
sleep 10
done
Event detection:
Safety Features
1. Active print protection - Cannot send files while printing 2. Confirmation prompts - All destructive actions require confirmation 3. State validation - Commands check printer state before executing 4. Clear warnings - Stop command shows prominent warning
Examples
Check if printer is busy
python3 scripts/snapmaker.py status | grep -q "RUNNING" && echo "Busy" || echo "Available"
Get remaining time
python3 scripts/snapmaker.py status --json | jq -r '.remainingTime'
Monitor temperatures
python3 scripts/snapmaker.py status --json | jq '{nozzle: .nozzleTemperature1, bed: .heatedBedTemperature}'
Troubleshooting
"Machine is not connected yet" (401 error):
/api/v1/connect first before any status queriescurl -X POST "http://192.168.0.32:8080/api/v1/connect?token=YOUR_TOKEN"Connection refused:
ping 192.168.0.32Invalid token:
config.jsonCan't send file:
python3 scripts/snapmaker.py status--force only if absolutely necessaryReferences
Dependencies
requests library (install: pip3 install requests)License
Part of OpenClaw skills collection.
π‘ Examples
Check if printer is busy
python3 scripts/snapmaker.py status | grep -q "RUNNING" && echo "Busy" || echo "Available"
Get remaining time
python3 scripts/snapmaker.py status --json | jq -r '.remainingTime'
Monitor temperatures
python3 scripts/snapmaker.py status --json | jq '{nozzle: .nozzleTemperature1, bed: .heatedBedTemperature}'
βοΈ Configuration
Create config.json in your workspace's snapmaker/ folder (e.g. ~/clawd/snapmaker/config.json).
Start from config.json.example.
Config format:
{
"ip": "192.168.0.32",
"token": "your-token-here",
"port": 8080
}
Finding your token:
Open the Snapmaker Luban app, connect to your printer, and find the token
in the connection settings. Copy it into your config.json.
π Tips & Best Practices
"Machine is not connected yet" (401 error):
/api/v1/connect first before any status queriescurl -X POST "http://192.168.0.32:8080/api/v1/connect?token=YOUR_TOKEN"Connection refused:
ping 192.168.0.32Invalid token:
config.jsonCan't send file:
python3 scripts/snapmaker.py status--force only if absolutely necessary