Having failed miserably to bridge my Mosquitto add-on to CloudMQTT because the add-on wouldn’t open my conf file for some reason I am now trying Node-RED.
I have an MQTT-in node correctly connected to CloudMQTT and reading everything published there.
I am injecting the payload form that node directly into an MQTT-out node which is connected to my Mosquitto.
Every time something is passed to it though it disconnects for a few seconds and then re-connects. I’ve tried just injecting it as a string but it does the same.
Both debug nodes always show exactly the same, and correct output.
I did this to confirm that the MQTT-in was actually forwarding the message correctly and also to prove to myself that I had set up the inject to injecting the correct message.
There is definitely a problem with the MQTT-out. I am using localhost rather than 127.0.0.1 but that should be the same thing. Yes? I don’t understand why it disconnects whenever it receives a message from either the inject or the MQTT-out (and therefore doesn’t receive the message).
I’m not sure what you mean about where I publish the message, the inject node looks like this:
Using your idea of injecting a test string works fine as I can see it appearing on MQTT.fx
The data I want to inject is the data that Owntracks is passing to CloudMQTT.
So there must be something about that message being injected into the MQTT-out that is causing it to disconnect.
I need to add I am running this on hassio with the Mosquitto add-on.
There should be no issues with passing the data from CloudMQTT in the way your doing. I have just tried on a test PI and changed nothing but the topic without issues. So my out node…
Can you setup a test pi and just install mosquitto and nodered… I suspect you will see things work as they should. Should only take 20mins or so to prove. I suspect this is to do with your MQTT broker add-on… If you pass a string, as your “inject” is doing, it should be almost impossible to break.
Why don’t you just point owntracks to your mosquitto broker, I know it requires you to open up a port to the world but it will save you needing to do this?
@anon59013933, @flamingm0e
Thanks to both of you. I have it working now, I started again from scratch. it was a combination of errors/misunderstandings on my part but your suggestions pointed me in the right direction.
Thanks again.
@jimpower Yes I did have everything working perfectly with an open port but have recently closed it for security reasons. I tried bridging Mosquito to CloudMQTT using:
I have, yes. I posted about this a few days ago (CloudMQTT - Mosquitto - bridge) with full details and the error message but got no responses - I’d be grateful if you’d look