No update in Domoticz

#1

This basic project is to support multiple sensors to communicate via Node-Red to Domoticz.
Sensors

ESP8862 > MQTT > Node-Red > MQTT > Domoticz
The sample flow works fine till the moment that Node-Red has to update a variable in Domoticz.

type or paste code here
```[{"id":"738d2506.c6d1cc","type":"debug","z":"582c68b5.350268","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":490,"y":220,"wires":},{"id":"7b557eca.a619f","type":"mqtt in","z":"582c68b5.350268","name":"","topic":"temperature_topic","qos":"2","broker":"a693e4e6.945728","x":130,"y":180,"wires":[["97af2374.45b52","fa710cbd.f1788"]]},{"id":"97af2374.45b52","type":"debug","z":"582c68b5.350268","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":370,"y":120,"wires":},{"id":"473054c0.899f9c","type":"mqtt out","z":"582c68b5.350268","name":"","topic":"Domoticz/in","qos":"0","retain":"","broker":"a693e4e6.945728","x":490,"y":360,"wires":},{"id":"fa710cbd.f1788","type":"function","z":"582c68b5.350268","name":"temperatuur dht11","func":"msg.payload = {\n "idx":29,\n "nvalue":0,\n "svalue":"12.1"};\nreturn msg;\n","outputs":1,"noerr":0,"x":290,"y":280,"wires":[["473054c0.899f9c","738d2506.c6d1cc"]]},{"id":"a693e4e6.945728","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

The ESP is reading the DHT22 temperature sensor, brings it into the Node-Red flow and 
there it stucks. The temperature_topic shows the right value in the msg.payload/debug screen.
The function node, with the following dscription, is not able to transfer the data into Domoticz.
 msg.payload = {
    "idx":29,
    "nvalue":0,
    "svalue":"12.1"};
return msg;
With the following statement in Putty I am able to preform that action with any problem.

mosquitto_pub -h localhost -m '{"idx" :29,"nvalue":0 ,"svalue":"99.0"}' -t 'domoticz/in'

Any idea what I do wrong?
Thanks in advance.

![mqtt%20error|690x260](upload://5SYyF644xYcGXkl4YEvZFsz4ZYI.png)
0 Likes

#2

Please read https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506
and edit your post to make your flow importable

0 Likes

#3

and

See anything different?

0 Likes

#4

Colin,
The first statement in PUTTY works fine, it updates the Temparature variable in Domoticz.
The code in the Node-Red function gives no reaction in Domoticz.

0 Likes

#5

domoticz/in and Domoticz/in' are NOT the same.

0 Likes

#6

Yes, that works, but does
mosquitto_pub -h localhost -m '{"idx" :29,"nvalue":0 ,"svalue":"99.0"}' -t 'Domoticz/in'

0 Likes

#7

Colin,
Sorry, but the statement with the capital D in Domoticz doesn't work.
Any other ideas?

0 Likes

#8

@Accelerator you are publishing to domotiz/in - but you are subscribed to Domotiz/in.
So Node-RED is subscribed to a different topic to what you're publishing to.

Have you tried publishing and subscribing to the same topic?

0 Likes

#9

Or subscribe using the MQTT wildcard to see all published messages

0 Likes

#10

Of course not, that is the whole point. You said that it works if you publish with a lower case d, but in the node red flow you are publishing with upper case D. Change the flow to use lower case and it should work.

0 Likes

#11

Gentlemen thank you for the quick reponses, problem solved

0 Likes