Mqtt-docker for Home Assistant

Robert Andresen Home Assistant, Internet of things, Tutorials Leave a Comment

In this post, I created a simple PHP-to-MQTT integration for Telldus Tellstick. I used CloudMQTT as a broker, but after upgrading HA to 0.107 it stopped working for some reason.

When I started to troubleshoot this, I started wondering why I have used a third-party broker. Maybe it was before I started with docker…

So i just fired up an own MQTT-broker in Docker. I added this to my docker-compose.yaml (see my full docker-compose.yaml file at the end):

I had to map port 9001 to 9002, as Portainer uses 9001. Not sure if I actually need the 9001 port. Looks like it’s for websockets?

To only start the MQTT-container in my composer file, I typed:

I had to change the configuration.yaml in HA, with the new MQTT settings. As this is now running locally, i probably wouldn’t need to have the config in my secret file.

Tip

I used MQTT-Explorer from Windows store to see that it was working.

My full docker-compose.yaml