TERMINAL API Curl Variable commands

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

I was doing the same with dos batch file which is helpful to locate the pixel when messing with the mapping

for /l %%x in (0, 1, 44) DO (
curl http://10.0.3.34/json -d  {"seg":{"i":[%%x,[255,255,0]]},"fx":115,"transition":5} -H "Content-Type: application/json"
)

You are making a usermod ?

@ALDIY No im not making a Usermod on that
And what is interesting the OS does matter on this kind of Action

Unix/Linux does bhave diverent on CURL Batch
Syntay does matter

Okay , just because it is in the usermod title i thought you plan to do a console to control or issue those commands even to other units ( a lot of guys asked for this and if you think about it ,it would be great same as you could do now in Tasmota console or berry scripting )

And yeah i have seen also that the json format is very finicky so from mac or from god forbid HA you would have to mess with the formats specifically the quotes

@ALDIY first at all the main DEVELS shoudt vonsider a BASH preset with USER API commands

like
INIT{ Vars and startsetup}
DO{ THE LOOP here comens the API command}

i think there is somthing like this in JASON but it is not implemented in the DEV
or Simply not Known to puplic

############
Most users with this kind of ““hobby”” LED expiriances know to do things in ARDUINO IDE
woudt be good to get somthing simple for USERDisplay