Setting up MQTT in Home Assistant Container

I’m running Home Assistant Container in Docker, alongside Portainer. I’ve actually downloaded Eclipse Mosquitto as its own container as well, but I’m having trouble getting MQTT set up in Home Assistant. The traditional way is to use Supervisor / Addons to set up MQTT, but Home Assistant Container does not have this option. Has anyone have a workaround for this?

Use the integration

HA >> settings >> devices and services >> add integration >> mqtt

When connecting docker containers I use the host name of container as this prevents issues if docker decides to change the docker IP. By using this method you only need expose ports if connecting outside docker network

You can use portainer to set hostame if you did not do so during container creation

EDIT

If it is not clear, the integration will connect to the mosquitto container you setup.

im assuming your looking for a specific instruction how to setup mqtt (mosquitto) server. In that case you can just follow the video below how to setup a new mqtt server via docker and add it up to home assistant.

Run Your own LOCAL MQTT broker to control your IoT devices in Home Assistant - YouTube

I used to have HAOS installed but ended up moving my install into an all container install because it’s actually much simpler to update, manage, rollback and recover if something oopsie happens.

1 Like

You could also follow this instruction
MQTT HA
HAOS and Docker set-up explaned.

Cheers,
Mike

Thanks very much for this. I was able to successfully setup MQTT as a docker container, and get it set up in Home Assistant.

It seems like if you were to do this with Supervisor, it would automatically create an entity card in your Overview. But since I’m not using Supervisor, I’m searching around for a way to display an MQTT message in Home Assistant. Any ideas on home to manually setup an entity or a button or something for the Overview home page to acknowledge when Home Assistant receives an MQTT notification? So far I’m not having any luck.

You can show it as persistent message

This thread may have some examples

Thanks very much for the response. I’ve been researching persistent messages, blueprints, automations. I can’t figure out how to edit configuration.yaml with Home Assistant Container, or set up hass-configurator-docker to edit configuration.yaml. I’m told the “MQTT Integration” should to much of the heavy lifting, but I have no idea leverage it.

SSH onto machine and edit the file

There are more gui friendly methods but it depends on the OS.