id like to share some infos on Direct NET Commands
here a example on CURL using VARiables and integration via JQ (jq)
Example standard 30LED Stripe
FIRST lets set the top 15 LED on GREEN (0,255,0) and the others14-30 OFF Black
curl -X POST "http://YOUR WLED IP/json/state" -d '{"on":true, "bri":25, "seg":{"i":[
0,15,[0,0,0],14,30,[0,255,0]]}}' -H "Content-Type: application/json"
then use a for loop to make a Hourglas effect
led=1;for x in {0..14..1}; do r=$(jq -cn --arg led "$led" '($led|tonumber) as $led | {on:true,bri:25,seg:{i:[0,$led,[0,255,0],30-$led,[0,0,0]]}}'); curl -X POST "http://192.168.2.100/json/state" -d $r -H "Content-Type: application/json";echo "nummer $led"; sleep 1;((led++)); done
EXplaining
led=1 is the VARIABLE to be incresed
the Terminal Bash separeter are " ; "
for x in {0…14…1}; this makes the loop 15times 0-14 in steps 1
do —> does the codeblock
r=$(jq -cn --arg led “$led” ‘($led|tonumber) as $led | {on:true,bri:25,seg:{i:[0,$led,[0,255,0],30-$led,[0,0,0]]}}’); —> this is the string to be generaded and passed to the CURL -d Part as -d $r
CURL does the sending to the IP adress of your WLED
have fun with your own sequences