Replacing Cloudmqtt broker with my own via mosquitto

I’ve been using the excellent cloudmqtt since my early days getting to know MQTT. It’s been flawless except for about 3-4 times this month where it failed and I had to contact cloudmqtt support. Now I have to praise the support team as they did an excellent job very quickly, but the few faults made me think it was time to get myself my own broker.

In addition to going away from potential third party failures, it would allow me to keep controlling my devices should I have any internet access issues.

So I followed this page to set up mosquitto on my server.

Once done, I didn’t want to just switch everything over from cloudmqtt to mosquitto as I have quite a few devices to connect to cloudmqtt, some less accessible than others. I therefore created a bridge between my mosquitto and cloudmqtt to get the best of both worlds.

This was done by a new mosquitto config in the` /etc/mosquitto/conf.d/ directory`, I used cloudmqtt.conf (it can be any name as long as it ends with .conf so mosquitto will read it) with the following info:

connection cloudmqtt
address <Cloudmqtt Server>:<Cloudmqtt Port>
remote_username <Cloudmqtt User>
remote_password <Cloudmqtt Password>
clientid <Cloudmqtt user>
try_private false
start_type automatic
topic # both

All I then had to do was to point my Home-Assistant config to my own mosquitto broker.

Et voilà !