Page 1 of 1

Solved: Domoticz Lux JSON not working

Posted: Thursday 08 March 2018 13:57
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

Re: Domoticz Lux JSON not working

Posted: Thursday 08 March 2018 14:05
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"
}

Re: Domoticz Lux JSON not working

Posted: Thursday 08 March 2018 14:55
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