Page 1 of 1

Uservariable not updating via API-command

Posted: Friday 03 March 2017 9:00
by DutchHans
Good morning,

(Raspberry Pi3 on the latest Beta)

I am trying to update a uservariable (according to the wiki) with the API command from a LUA script:

Code: Select all

os.execute('http://xxx:[email protected]:8080/json.htm?type=command&param=updateuservariable&vname=RainPrediction&vtype=2&vvalue=25')
The Uservariable(String) is not updating. but when I give the same command in the browser, it works.
{
"status" : "OK",
"title" : "UpdateUserVariable"
}
Am I missing something?
Please help.

Regards, Hans

Re: Uservariable not updating via API-command

Posted: Friday 03 March 2017 9:46
by Nautilus
Try:

Code: Select all

os.execute('curl -s "http://xxx:[email protected]:8080/json.htm?type=command&param=updateuservariable&vname=RainPrediction&vtype=2&vvalue=25" &')
You need to tell "what" it is that should open the url, in this case "curl". Plenty of examples here on the forum :)

Re: Uservariable not updating via API-command

Posted: Friday 03 March 2017 10:01
by DutchHans
Nautilus,

Thank you so much, that did the trick.

Regards, Hans