Setting up Mosquitto
The official Mosquitto broker add-on is the MQTT broker in your home. We set it up so that it can fetch the CampMatic readings in the next chapter. The order of these steps matters more than it looks.
customize is switched on under Configuration and that the folder /share/mosquitto exists. We need both in a moment. Otherwise skip straight to the next chapter. Install Mosquitto
Open Settings → Apps and click Install app at the bottom right. Search for Mosquitto broker and install it. Do not start it yet.
Create the folder — before you go on
Mosquitto is about to read an extra configuration file. The folder for it must exist beforehand, otherwise the add-on will refuse to start. Create /share/mosquitto — using the File editor or Terminal & SSH add-on, for example.
mkdir -p /share/mosquitto
customize while the folder is still missing, and the add-on starts and immediately quits again. The interface just says stopped, with no explanation. The reason appears only in the add-on log:Error: Unable to open include_dir '/share/mosquitto'mosquitto version 2.1.2 terminating configuration.yaml lives in /config — which the Terminal add-on also shows as /homeassistant, the very same folder. /share sits beside it and starts out empty. The bridge file belongs in /share, not with your configuration. Allow your own configuration
Only now: Settings → Apps → Mosquitto broker → Configuration. Scroll down to the collapsed Customize section and open it. Switch active on and set folder to mosquitto — it is usually filled in already. Then hit Save.
Together these two settings make Mosquitto read every .conf file in /share/mosquitto/ when it starts.
Now start the program — the button sits on the info page under Control. The Log tab should then show that Mosquitto is running:
mosquitto version 2.1.2 running
Successfully send discovery information to Home Assistant.
New connection from ::1 on port 1883Protocol error from ::1: First packet not CONNECT (0A)That is the watchdog checking whether the broker responds. Not an error, nothing to do.
Add the MQTT integration
The add-on announces itself to Home Assistant. Under Settings → Devices & Services a suggestion for MQTT appears. A single click on Submit is enough — Home Assistant fills in broker, port and credentials itself.
core-mosquitto and port 1883 by hand: that is only needed when the suggestion does not appear. - The Mosquitto broker add-on is running — state started
- The folder
/share/mosquittoexists - The add-on configuration says
customize: active: true - The MQTT integration is set up under Devices & Services