Use NodeRED as MQTT Bridge

Im trying to forward from MQTT in to MQTT out connection
They on diffrent MQTT connections, (the input from hiveMQ broker and the the output is for AWS IoT core)
why it is dosent work for me
image
I also tried to add aFunction which return msg.payload but still

Thanks

No idea. It should work. Have you configured 2 separate configs (show us the config dropdown in one of your MQTT nodes)

Have you seen any messages arrive? (hint: add a debug node after MQTTsub_sensor)

Have you got the configs correctly configured and pointing at the correct brokers?

still what?

Try adding a debug node after the function - do you see MQTT values?

Hi, yes I added debug after the MQTTsub_sensor the message is arriving
and I get he messages from the timestamp in the AWS

the message that arrived in the MQTTsub_sensor is a JSON format message so it is show that as an object, maybe that cause the problem ?

But you have not said what the problem is!

MQTT is perfectly happy with JSON formatted payloads.

Are you passing msg.topic to MQTTpub_aws or is the topic set in the node config?

the problem is that Im not get the message from the MQTTsub_sensor in the AWS IoT core
but I get the message from the timestamp node
so the probelm is not the configuration in the MQTTpub_aws

Unless the AWS broker has the means to reject the JSON data (which BTW is sent as a string) then all I can think is the topic is NOT set in the AWS node and your values are going to the topic set from the incoming data of the MQTT-IN node

It is hard to tell as you have not shared a flow or shown us how you have configured the nodes.

I set topic in both mqtt nodes, but they are different (becuase there is different mqtt brokers and different systems)

when I change that the will have the same topic it is work
it is sound strange for me because I want to use NodeRED for listening for few different systems with different MQTT brokers

What is the size of the JSON string you are sending? Does AWS MQTT have a size limit?

Please, with the working version, select the two mqtt nodes and use the Export feature to copy to clipboard and paste that here, using the </> button at the top of the forum entry window when pasting it in.
Then do the same with it configured with the different topics. Then we can see exactly what you are doing.

What is the topic where the payload will be published ?
AWS "fake" MQTT implementation is not MQTT compliant... It can only support 7 levels of topics.
Which is according to AWS a "good practice" see :

There might well be other limitations that AWS may explain as good practices :wink:

1 Like