Add a debug node showing what you are sending to the mqtt node, and show us how you have configured that node.
the mqtt one or the debug node? data are correct, in the debug of node red i can see the right data
That's great you can see the data, now can you do as @colin asked and show it to us?
It would be helpfup if you posted an export of your flow since no one but you can see it.
In order to make code more readable and importable it is important to surround your code with three backticks
```
like this
```
You can edit and correct your post by clicking the pencil icon.
See this post for more details - How to share code or flow json
So, I have in my description of MQTT-out node:
msg.topic=msg.payload.main.temp;
return msg.topic;
where msg.payload.main.temp is the data I read correctly from the sensor as I see in the debug window but that I can manage to publish on my broker (although my broker says there has been the entry of the data)
Hi, it looks like you dont quite get the concepts.
-
topic
is a name like"room1/temperature"
-
payload
should be the value e.g.21.5
you send these in a msg
object to the mqtt-out node...
msg.topic = "room1/temperature";
msg.payload = msg.payload.main.temp
return msg;
try sending that to your mqtt out node.
Also, try subscribing to topic "room1/temperature" - you will see a value when the publish occurs.
Ok, I got "Invalid topic specified". I think the topic is correct because I know the structure of topic on thingspeak. I have to use " ", right?
No. Just put room1/temperature not "room1/temperature" in the MQTT node.
still doesn't work. I don't have to write the topic also in the topic section because I am setting the node via msg, correct?
Why not make life easy for yourself, and just specify the topic in the MQTT node instead of using the input msg...
Then all you need to do is to inject the sensor reading as a payload.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.