Page 1 of 1

json.html structure

Posted: Saturday 10 March 2018 15:55
by YellowSky
Hi everyone,
i have a question about json structure.
In the wiki some of the sensor does not require nvalue=0 in the url.

For example the counter require:

Code: Select all

/json.htm?type=command&param=udevice&idx=idx&svalue=COUNTER
But if i try:

Code: Select all

/json.htm?type=command&param=udevice&idx=idx&svalue=COUNTER&nvalue=0
The answer is the same and the counter is updated.

Therefore why some sensors does not require this nvalue? And I wonder if there is any trouble to put one.
Indeed some others sensors must be finished by a

Code: Select all

;0
. If not the wiki says there could be a problem of database.

Thank you

Re: JSON structure

Posted: Sunday 11 March 2018 14:00
by asjmcguire
OK - first it isn't the JSON structure, JSON is something different - it's just that the URL is json.html which is a bit confusing.

svalue = STRING value
nvalue = NUMBER value

Sensors that require ;0 are devices that store more than one value - eg a Temperature and Humidity sensor, when it is updated requires TEMP;HUM and obviously it can't be a number if it has ; in it so it has to be a svalue eg: svalue=18.7;85

Re: json.htlm structure

Posted: Monday 12 March 2018 5:37
by YellowSky
Thank you for this answer.
So if i send a non expected nvalue, there is no problem?