Home Assistant and Zigbee2MQTT

On a Raspberry Pi, Home Assistant as-an-OS appears to run everything in Docker containers, with pass-through of USB and filesystem access. This means that things like the Mosquitto and Zigbee2MQTT add-ons are all in their own docker container. This poses a problem when the default configuration for something like Z2M is “mqtt://localhost:1883”, because it can’t reach that port on localhost – ECONNREFUSED.

This is logical; that port isn’t open on localhost, because localhost is inside the docker container.

The simple fix is to toggle over to the DNS name of the Home Assistant installation. In my case, homeassistant.home.arpa (RFC 8375).