Change variable value only via JSON

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
cjnicholl
Posts: 36
Joined: Thursday 06 November 2014 15:59
Target OS: Linux
Domoticz version: 2564
Contact:

Change variable value only via JSON

Post 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
cjnicholl
Posts: 36
Joined: Thursday 06 November 2014 15:59
Target OS: Linux
Domoticz version: 2564
Contact:

Re: Change variable value only via JSON

Post by cjnicholl »

Not sure how this is solved?
Nobody ever answered me...
tonygair
Posts: 12
Joined: Wednesday 09 July 2014 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Change variable value only via JSON

Post 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
**********************************
Using Raspberry Pi,
Aeon S2
Stella Z's
TKB68's
tonygair
Posts: 12
Joined: Wednesday 09 July 2014 14:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Change variable value only via JSON

Post by tonygair »

**********************************
Using Raspberry Pi,
Aeon S2
Stella Z's
TKB68's
jannl
Posts: 625
Joined: Thursday 02 October 2014 6:36
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.2
Location: Geleen
Contact:

Re: Change variable value only via JSON

Post 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
continent
Posts: 12
Joined: Monday 17 August 2015 22:15
Target OS: Linux
Domoticz version: 4.11605
Location: The Netherlands
Contact:

Re: Change variable value only via JSON

Post 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];
Last edited by continent on Sunday 31 January 2016 23:32, edited 1 time in total.
Gigabyte with Debian, 4 Shelly's 2.5 (rollerblinds), 3 Shelly's dimmers, 3 Shelly plugs,
8 x DB1820, ESPeasy with 8 relay's, RFXcom, Enocean USB300, 2 x Enocean STM 330.
paulvha
Posts: 40
Joined: Friday 29 January 2016 16:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Netherlands
Contact:

Re: Change variable value only via JSON

Post 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;
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest