MQTT in only read one of five topics

I use a ESP8266 module for irrigation. I read humidity setpoint from nodered dashboard and some data in return back to nodered. Humidity, ip address, rssi and temp. It worked fine. I added a function for reading consumed water. Still working fine, but after a while the debug node only logged the humidity. All values has the same beginning in topic name /W1/bev/fuktPV /W1/bev/flow /Wi/bev/temp /W1/bev/ip .... and the only the one ending fuktPV is working now.

The topic names in the ESP8266 program are correct. They all show up in the mosquitto log window including message. But the MQTT in node only read one of them.

Both mosquitto and nodered are installed in the same raspberry pi.

Any ideas?

Regards /Johan

The only info we have to go on is the 4 topics, as far as I can see your topics start with /. This is not correct they should not start with a /

What mosquitto log window?

Show us how you have configured the mqtt node(s)

Have you checked with a debug node directly on the MQTT node to see if the data are missing there?

As already stated, topics should not start with a /

Hi

The mosquitto log window is the command window in raspian after typing
mosquitto_sub -h localhost -t "#" -v
wich shows incoming and outgoing messages on the broker.

This is the humidity (fukt in my language) wich is working.
image

And this is the IP adress wich is not working...

Yes, as you can see on screenshots, I use the debug nodes to se the result.

I am confused about the '/'. I did not used it in the beginning before when it worked. Then I noticed that a SONOFF device had the message beginning with '/' and worked, so I tried it. Now after your comments I removed the first '/'. The result did not changed except that the broker log is no longer showing the messages. Only the messeges with a leading '/'.

Ok, after restart of mosquitto the log is showing messages without a leading '/'.

add a mqtt node with topic W1/bev/+ attach a debug . Does it receive the five topics and messages
p.s. we can not see your screen, please supply some debug's please.

I did that. W1 is changed to W4 but except that all is as before.
With W4/bev/+ all the other values is read in the debug node.

So W4 topics are being received, your other post shows they are W1 topics in the mqtt settings

Yes. After I started this tread I slipped with a screwdriver and damaged the ESP8266 unit. So I toked another one and downloaded the same program after changing everything with W1 to W4. Sorry if I confused you. The behavior of the W4 is the same as the W1.

Any idea why the mqtt in node is reading when using W4/bev/+ but not when using for example W4/bev/flow?

Mark all those nodes and Export them (Ctrl-E) and paste it here so we can see how everything is configured. See this post for more details - How to share code or flow json

Also which version of node-red are you using (look at the bottom of the dropdown menu) and which version of nodejs?
node -v

Do you have a space at the end of the topic name?

[{"id":"27a70c11.378154","type":"mqtt in","z":"cf7dcc4b.adbae","name":"IP","topic":"W4/bev/ip","qos":"2","datatype":"auto","broker":"fb2cded4.11a59","x":150,"y":100,"wires":[["bfb3f5de.24ffd8"]]},{"id":"cdd6b61f.5d3a48","type":"mqtt in","z":"cf7dcc4b.adbae","name":"W4/bev/fuktPV","topic":"W4/bev/fuktPV","qos":"2","datatype":"json","broker":"fb2cded4.11a59","x":180,"y":220,"wires":[["3bbca10c.dea8fe"]]},{"id":"3bbca10c.dea8fe","type":"debug","z":"cf7dcc4b.adbae","name":"W4 humitidy","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":670,"y":220,"wires":[]},{"id":"3aff1993.e8a476","type":"mqtt in","z":"cf7dcc4b.adbae","name":"W4/bev/flow","topic":"W4/bev/flow","qos":"2","datatype":"json","broker":"fb2cded4.11a59","x":170,"y":280,"wires":[["88639fe6.52ef7"]]},{"id":"88639fe6.52ef7","type":"debug","z":"cf7dcc4b.adbae","name":"W4 flow","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":280,"wires":[]},{"id":"bfb3f5de.24ffd8","type":"debug","z":"cf7dcc4b.adbae","name":"IP","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":650,"y":100,"wires":[]},{"id":"96ccb103.32224","type":"mqtt in","z":"cf7dcc4b.adbae","name":"","topic":"W4/bev/rssi","qos":"2","datatype":"auto","broker":"fb2cded4.11a59","x":170,"y":160,"wires":[["3a7b5aba.424136"]]},{"id":"384791c0.1a6ede","type":"mqtt in","z":"cf7dcc4b.adbae","name":"","topic":"W4/bev/+","qos":"2","datatype":"auto","broker":"fb2cded4.11a59","x":160,"y":400,"wires":[["4998d14a.ba1ee"]]},{"id":"4998d14a.ba1ee","type":"debug","z":"cf7dcc4b.adbae","name":"W4/bev/+","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":400,"wires":[]},{"id":"3a7b5aba.424136","type":"debug","z":"cf7dcc4b.adbae","name":"W4 rssi","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":160,"wires":[]},{"id":"2af92f83.f6b16","type":"mqtt in","z":"cf7dcc4b.adbae","name":"","topic":"W4/bev/temp","qos":"2","datatype":"auto","broker":"fb2cded4.11a59","x":170,"y":340,"wires":[["41f9b9ba.2d1cb8"]]},{"id":"41f9b9ba.2d1cb8","type":"debug","z":"cf7dcc4b.adbae","name":"W4 temp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":660,"y":340,"wires":[]},{"id":"fb2cded4.11a59","type":"mqtt-broker","z":"","name":"Rasselvägen MQTT","broker":"192.168.1.172","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""}]

The version of nodered is V1.0.6

Where do I type node -v?

Hi. Actually yes. In some cases. That can be the problem...
Coming back, my wife called for dinner...

Ok, this is embarrasing. Steve-Mcl, there was actually some spaces in the end of some topics. I guess I did some adjustments and the spaces sneeked in to the code. Should have noticed since I did looked it over many times after the trouble began. It is working fine now anyway.
Many thanks to all of you who was committed in this case.

Ragards /Johan

Its easy to overlook the obvious. A fresh set of eyes never hurts.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.