Files
klipper-macros/macros/bd_pa_write_spoolman.sh
T
mangavalkandClaude Opus 5.5 6dbb4ca3fb Initial import of my Klipper macros, modules and scripts
Macros as they run on the printer (Voron 2.4 + AFC Box Turtle +
Blobifier + Beacon + bd_pressure + bdwidth + iHeater), the Klipper
modules they need (xy_drift, bdwidth_status, bdpressure_check), MCU
firmware update scripts, install.sh with Moonraker update manager
support, and READMEs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 13:45:11 +02:00

23 lines
617 B
Bash
Executable File

#!/bin/bash
SPOOL_ID=$1
BASE_URL=$2
FIELD=$3
PA_VALUE=$4
CURRENT=$(curl -sf "${BASE_URL}/api/v1/spool/${SPOOL_ID}" 2>/dev/null)
EXTRA=$(echo "$CURRENT" | python3 -c "
import sys, json
try:
d = json.load(sys.stdin)
e = d.get('extra', {})
e['$FIELD'] = '$PA_VALUE'
print(json.dumps(e))
except Exception:
print(json.dumps({'$FIELD': '$PA_VALUE'}))
" 2>/dev/null)
if [ -z "$EXTRA" ]; then
EXTRA="{\"$FIELD\": \"$PA_VALUE\"}"
fi
curl -sf -X PATCH "${BASE_URL}/api/v1/spool/${SPOOL_ID}" \
-H "Content-Type: application/json" \
-d "{\"extra\": $EXTRA}" > /tmp/pa_spoolman_write_result 2>&1