I have a local MQTT broker running at home (Mosquitto on a Raspberry Pi). I’m interested in “bridging” it to Cayenne’s MQTT broker so that I can easily integrate my home setup with Cayenne without reprogramming my devices.
There is ample info online on setting up Mosquitto to bridge to external brokers. I think I’ve set up the config file correctly, Mosquitto’s output seems to show that messages are going out to Cayenne, but Cayenne doesn’t seem to be receiving them.
I’d be interested to hear from anyone who’s successfully got MQTT bridging set up…
@adam Node-RED is an interesting approach. Maybe not as elegant as in-built MQTT remapping but it should work!
I’ve tried it two ways with Node-RED (my own code, and the one you provide for import) and the issue I have is that the node that connects to the Cayenne MQTT server can only stay connected intermittently. It’s “disconnected” most of the time. I’ve checked username / password / ClientID and they’re all good. Not sure what is going on.
Do you have more than one device connecting to the Cayenne servers with that username/password? I saw the same thing when I had more than one device connecting.
I thought that too. But I created a new Bring Your Own Thing device and put its ClientID everywhere and still get the same problem. “Disconnected”. I’m wondering if Node-RED has an issue with long ClientID fields (I had a related MQTT issue with a desktop MQTT client not “playing nice” with Cayenne for that very reason)
Topic is v1/my-very-long-username/things/my-very-long-clientID/data/1
Not sure it matters, though, as the “disconnected” symbol next to the Cayenne MQTT node would seem to indicate that it’s not getting through to the Cayenne MQTT broker at all.
I tried hooking up the output of the node that generates the message back to my own MQTT broker and everything comes through fine. It’s something about how I have Node-RED set up with the Cayenne MQTT server. I’m wondering if Node-RED somehow is truncating my Cayenne Client ID (as I had an issue recently with this)
Can I ask what you’re using in the settings? Keep alive time, clean session, etc.? And what version of Node-RED you’re using?
For anyone interested, I figured out the problem – Node-RED seems to silently truncate passwords when, after setting up the MQTT server information, you re-visit the MQTT server settings field on an MQTT node. A bit complicated but it seems that “set it and forget it” is the best option.