[solved] Mqtt over internet? aka: "How to set up cloudMQTT bridge with Hassio mosquitto broker"

I have not worked with NodeRed at all, but i figured it out without it.
Here is how i did it, by compiling info from all around the community forums:

  • Register CloudMQTT free account.
  • Ignore the initial un/pw and create two (in my case) new users with their own passwords.
  • In the users page of cloudMQTT, scroll down after creating the users and click topic, select the user, add # (in case you want them in on everything) in the pattern box, then tick read/write access accordingly and add them twice (for muy two users).
  • Then set up the sonoff with the new user/password and ip/port settings to connect to the cloud mqtt.
  • Go check the logs on the mqtt website, to see that the user connected and open the websocket UI to see if its publishing the messages (having teleperiod 10 on the sonoff helps a lot)

Now we need to set up the Hassio mosquitto broker to connect to the cloudmqtt as a bridge:

  • Assuming you already have set up samba share, go to your hassio/share folder and create a new folder called mosquitto.
  • In there, add a new text file and save it as cloudmqtt.conf (any filename should work i think, the important part is the .conf extention)
  • In there, i pasted the following text:
connection cloudmqtt
address cloudmqttIPaddress:PORT #you get these from the details page on cloudMQTT
remote_username HA-USER
remote_password HA-PASS #whatever un/pass you set up for HA above on the cloudmqtt users 
clientid HomeAssistant
try_private false
start_type automatic
topic # in
  • Go to Hass.io addons page on your HA (this usually does not load for me for some reason, i found that selecting the address bar and forcing it by hitting enter speeds up things)
  • Open your Mosquitto Broker addon and change this part from false to true:
  "customize": {
    "active": true,
    "folder": "mosquitto"
  • No fire up your favorite mqtt client app and connect to your HA broker to subscribing to # topic.
  • You should see the messages there.
  • From there, go create your mqtt sensors in the mqtt conf files.

Hope this helps someone looking for the same thing.
It’s just a compilation of information i found on the community forums that worked for me.
Kudos to all the users of the forums who i cant cite for obvious reasons :slight_smile:

12 Likes