Lua Script tu update a device with json url -help

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
thaui
Posts: 59
Joined: Sunday 15 March 2015 19:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Hamburg
Contact:

Lua Script tu update a device with json url -help

Post 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
User avatar
jvdz
Posts: 2445
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

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

Post 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.
User avatar
psubiaco
Posts: 233
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

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

Post 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\"")
Last edited by psubiaco on Saturday 19 August 2023 14:53, edited 1 time in total.
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
thaui
Posts: 59
Joined: Sunday 15 March 2015 19:53
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Hamburg
Contact:

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

Post 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
User avatar
psubiaco
Posts: 233
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

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

Post by psubiaco »

Ok, I've edited my post to let people solving this issue quickly.
Have a nice weekend!!
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest