Page 1 of 1

Lua Script tu update a device with json url -help

Posted: Saturday 19 August 2023 12:13
by thaui
Maybe somebody can help to find a solution. I am trying to add a local variable to a json url command without success. The following command is working well and the RBG color will change.
os.execute('curl "http://127.0.0.1:8080/json.htm?type=com ... hite=false"')

but if I replace the hex value by a local variable the curl command end with an error.
os.execute('curl "http://127.0.0.1:8080/json.htm?type=com ... hite=false"')
I tried serveral things to to create first the the http string and store it to a variable but everything will fail.
What am I doing wrong? Please help

Re: Lua Script tu update a device with json url -help

Posted: Saturday 19 August 2023 12:36
by jvdz
Post your lua script code in a codebox </> so we can see exactly what you coded and tell us the error you get.

Re: Lua Script tu update a device with json url -help

Posted: Saturday 19 August 2023 12:39
by psubiaco
Edited:
THIS DOES NOT WORK

Code: Select all

os.execute("curl http://127.0.0.1:8080/json.htm?type=command&param=setcolbrightnessvalue&idx=14&brightness=12&hex=" .. RGB .. "&iswhite=false")
THIS WORK CORRECTLY!

Code: Select all

os.execute("curl \"http://127.0.0.1:8080/json.htm?type=command&param=setcolbrightnessvalue&idx=14&brightness=12&hex=" .. RGB .. "&iswhite=false\"")

Re: Lua Script tu update a device with json url -help

Posted: Saturday 19 August 2023 14:44
by thaui
@psubiaco
the first recommended line is not generating any error in the protocol, but it's also not doing anything.
the second one is working well. Thanks you saved me many hours of playing around

Re: Lua Script tu update a device with json url -help

Posted: Saturday 19 August 2023 14:54
by psubiaco
Ok, I've edited my post to let people solving this issue quickly.
Have a nice weekend!!