Problem with using the MQTT node

#1

I'm having a problem with the MQTT node, as the title suggests. I can't give the flow for specific reasons, but it goes about as follows:

  • The flow receives data from a non-problematic MQTT (input) node, with a set IP, port, and topic
  • The data is sensor data from multiple smartsensors
  • The data is parsed into a desirable form, gathered for some amount of time, and then averages from this time frame are calculated
  • These averages are then given to another MQTT (output) node, with the same IP and port, but a different topic from the first one

The problem starts here. In the same flow, I have an MQTT input node that reads the IP, port, and topic of the MQTT output node, which is supposed to output the parsed data.
Each of my MQTT nodes reads as "connected" and the green dot is on continuosly, so the problem is not in my connection.
I have tried to manually inject a string, a JSON, and a timestamp through the MQTT output node, and they all are received successfully on the other side.
When debugging the last node before the MQTT output node, the messages are as desired, i.e. objects.

I didn't find anything related to this, but I'm sending sort of multiple messages to the MQTT output node. I tried using the node.send() function to send the messages one at a time (in a for loop), but it didn't work. I also tried to use the [[msg1, msg2]] method with no luck.

Everything I try to send through the MQTT node manually goes successfully, but the function that injects data at specific times does not seem to be accepted, even though the message is perfect in the sense that viewing it with the debug node is not a problem and the data looks as desired.

This setup also used to work a while back, before I had to return to the parsing to make some modifications. The data that is output to the MQTT is unchanged in appearance though.

Best regards and thanks in advance.

#2

When you say that the message entering the MQTT node is an object is the bit you want to send as msg.payload within the message object?

#3

Show us what you see in a debug node for the data that isn't getting sent.
Are you setting the topic in the message or hard coded in the MQTT Out node?

#4

This was it, thank you. I had removed the msg.payload and was giving some other attributes to the MQTT node. Apparently the node only accepts stuff under the payload flag.