Page 1 of 1

Change variable value only via JSON

Posted: Saturday 17 January 2015 10:17
by cjnicholl
Is it possible to change only the value of a variable via a JSON command?

Instead of:
/json.htm?type=command&param=updateuservariable&idx=1&vname=VariableName&vtype=2&vvalue=NewValue

Use:
/json.htm?type=command&param=updateuservariable&idx=1&vvalue=NewValue

or:

/json.htm?type=command&param=updateuservariable&idx=1&vtype=2&vvalue=NewValue

for example?

It's very easy to change the variable name by accident when creating JSON commands on other devices

Re: Change variable value only via JSON

Posted: Wednesday 28 January 2015 15:48
by cjnicholl
Not sure how this is solved?
Nobody ever answered me...

Re: Change variable value only via JSON

Posted: Wednesday 28 January 2015 16:49
by tonygair
Nor Me :) I've trying to change the thermostat setpoint on a device through JSON. I'm going to experiment, there is a page on this stuff but I sort of expected a bit more detail. its in my JSON Post

Re: Change variable value only via JSON

Posted: Wednesday 28 January 2015 16:50
by tonygair

Re: Change variable value only via JSON

Posted: Wednesday 28 January 2015 18:51
by jannl
Below how I change a uservariable of type string

http://ip:port/json.htm?type=command&param=updateuservariable&idx=12&vname=test&vtype=0&vvalue=0

Re: Change variable value only via JSON

Posted: Sunday 31 January 2016 15:08
by continent
I can't set my setpoint.
This is what I have, I try to send;
http://192.168.178.25:8080/json.htm?typ ... e=SetPoint;
I send 33 degrees, Data and Setpoint changed to zero (0.0) degrees.

Do I something wrong?

To get the values works perfect with this script;
$json_string = file_get_contents("http://192.168.178.25:8080/json.htm?typ ... es&rid=$id");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$q = $parsed_json[$item];

Re: Change variable value only via JSON

Posted: Sunday 31 January 2016 15:42
by paulvha
to the question from cjnicholl

According to the source code, you have to provide all the variables:
if (idx.empty() || variablename.empty() || variablevalue.empty() || variabletype.empty())
return;