Solved: Domoticz Lux JSON not working

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
phloks
Posts: 7
Joined: Friday 21 July 2017 9:59
Target OS: Linux
Domoticz version: 3.8185
Location: NL
Contact:

Solved: Domoticz Lux JSON not working

Post by phloks »

Hi,

I own a WH3080 weather station which also transmits data about LUX/UV-index.
I receive this data using an RTL_433, send it to a Mosquitto MQTT server where I parse the data coming from the WH3080.

The WH3080 sends 3 types of messages, with msg_type 0, 1 or 2.
One of these messages looks like this:

Code: Select all

{"time" : "2018-03-08 13:42:22", "model" : "Fine Offset Electronics WH3080 Weather Station", "msg_type" : 2, "uv_sensor_id" : 100, "uv_status" : "OK", "uv_index" : 1, "lux" : 5135.600, "wm" : 7.519, "fc" : 477.2
86}
Using a little javascript code in a function node of Node-Red, I split up all these values, and one of them is obviously "lux" : 5135.600.

As per the JSON/API definitions of Domoticz ( https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s ) I think I need to use this:

Code: Select all

/json.htm?type=command&param=udevice&idx=IDX&svalue=VALUE
I'm using MQTT to talk to Domoticz (topic domoticz/in), and I'm sending the next JSON

Code: Select all

{"idx":14,"svalue":17777}
which IMHO corresponds to the json URL above....
(I'm using the same technique to send the uv-index to Domoticz, and this works correctly.

Domoticz, however, says the there's an error:

Code: Select all

Error: MQTT: Invalid data received!
Can anyone tell me what the correct JSON is for a device of type Lux, please ?

Thanks,
Hans
Last edited by phloks on Thursday 08 March 2018 14:55, edited 1 time in total.
funny0frank
Posts: 5
Joined: Friday 20 October 2017 8:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Domoticz Lux JSON not working

Post by funny0frank »

"svalue" is a semicolon string, you're sending it as a number.

For good measure I would just send the full object when communicating with domoticz:

Code: Select all

{
	"command": "udevice",
	"idx": 1,
	"nvalue": 0,
	"svalue": "17777"
}
phloks
Posts: 7
Joined: Friday 21 July 2017 9:59
Target OS: Linux
Domoticz version: 3.8185
Location: NL
Contact:

Re: Domoticz Lux JSON not working

Post by phloks »

Thanks,

That was it !
For now, I solved by changing the javascript to :

Code: Select all

var lux='' + msg.payload.lux + '';
and send this to Domoticz via MQTT.

When I have time I will rewrite the code to reflect the full object.

Thanks again!
Hans
Post Reply

Who is online

Users browsing this forum: Doler and 1 guest