API - When to use nvalue and when svalue? Topic is solved

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
maho2nd
Posts: 3
Joined: Wednesday 24 May 2017 0:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

API - When to use nvalue and when svalue?

Post by maho2nd »

What does nvalue and svalue represent?

In the JSON-API sometimes the nvalue is used (Air quality) and most times the svalue is used (Temperature, etc.).
maho2nd
Posts: 3
Joined: Wednesday 24 May 2017 0:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: API - When to use nvalue and when svalue?

Post by maho2nd »

Thanks!
tvurce
Posts: 30
Joined: Saturday 27 October 2018 19:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: API - When to use nvalue and when svalue?

Post by tvurce »

I am interested too...
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: API - When to use nvalue and when svalue?

Post by waaren »

nValue = numeric ( one value -- INTEGER DEFAULT 0)
sValue = string ( multiple values -- VARCHAR(200) DEFAULT null )
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
tvurce
Posts: 30
Joined: Saturday 27 October 2018 19:12
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: API - When to use nvalue and when svalue?

Post by tvurce »

Yes. But in a lot of examples, there are numbers throwing to Domoticz with sValue. This is little bit confusing. But anyway, if one send number to Domoticz in sValue, it seems working (graphs, averages etc are calculated OK...)
febalci
Posts: 331
Joined: Monday 03 July 2017 19:58
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: API - When to use nvalue and when svalue?

Post by febalci »

You can find out when to use svalue or nvalue according to the device type in this page:

https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: API - When to use nvalue and when svalue?

Post by emme »

nValue (Numeric Value) is only integer and is used command option for existing devices:
ON(1)
OFF(0)
STOP(17)
DIM LEVEL(2)
(I think there are more, but up to know I know these)
any other value should be set to sValue (String Value)
The most dangerous phrase in any language is:
"We always done this way"
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest