MQTT broker for Home Assistant.
You can use this add-on to install Eclipse Mosquitto, which is an open-source (EPL/EDL licensed) message broker that implements the MQTT protocol. Mosquitto is lightweight and is suitable for use on all devices from low power single board computers to full servers. For more information, please see mosquitto.
Follow these steps to get the add-on installed on your system:
- Navigate in your Home Assistant frontend to Hass.io -> Add-on Store.
- Find the "Mosquitto broker" add-on and click it.
- Click on the "INSTALL" button.
The add-on has a couple of options available. To get the add-on running:
- Start the add-on.
- Have some patience and wait a couple of minutes.
- Check the add-on log output to see the result.
Create a new user for MQTT via the Configuration -> Users (manage users).
Note: This name cannot be homeassistant
or addon
, those are reserved usernames.
To use the Mosquitto as a broker, go to the integration page and install the configuration with one click:
- Navigate in your Home Assistant frontend to Configuration -> Integrations.
- Use the Add button and search for MQTT
- Configure the Broker, Port, Username, Password and Submit.
If you have old MQTT settings available, remove this old integration and restart Home Assistant to see the new one.
Add-on configuration:
{
"logins": [],
"anonymous": false,
"customize": {
"active": false,
"folder": "mosquitto"
},
"certfile": "fullchain.pem",
"keyfile": "privkey.pem",
"require_certificate": false
}
A list of local users that will be created with username and password. You don’t need to do this because you can use Home Assistant users too, without any configuration.
Allow anonymous connections. If logins are set, the anonymous user can only read data.
Default value: false
If set to true
additional configuration files will be read, see the next option.
Default value: false
The folder to read the additional configuration files (*.conf
) from.
A file containing a root certificate.
A file containing a certificate, including its chain.
A file containing the private key.
If set to true
encryption will be enabled using the cert- and keyfile options.
This add-on is attached to the Home Assistant user system, so MQTT clients can make use of these credentials. Local users may also still be set independently within the configuration options for the add-on. For the internal Hass.io ecosystem, we register homeassistant
and addons
, so these may not be used as user names.
Remove the ports from the add-on page network card (set them as blank) to disable them.
It is possible to restrict access to topics based upon the user logged in to Mosquitto. In this scenario, it is recommended to create individual users for each of your clients and create an appropriate ACL.
See the following links for more information:
Add the following configuration to enable unrestricted access to all topics.
-
Enable the customize flag
"customize": { "active": true, "folder": "mosquitto" },
-
Create
/share/mosquitto/acl.conf
with the contents:acl_file /share/mosquitto/accesscontrollist
-
Create
/share/mosquitto/accesscontrollist
with the contents:user [YOUR_MQTT_USER] topic readwrite #
The /share
folder can be accessed via SMB, or on the host filesystem under /usr/share/hassio/share
.
- Since version 4.1 of the add-on, an explicit ACL definition is now required if you plan to use legacy logins and
"anonymous": true
see these instructions.
Got questions?
You have several options to get them answered:
- The Home Assistant Discord Chat Server.
- The Home Assistant Community Forum.
- Join the Reddit subreddit in /r/homeassistant
In case you've found a bug, please open an issue on our GitHub.