MQTT Broker

The MQTT integration needs you to run an MQTT broker for Home Assistant to connect to.

Run your own

The most private option is running your own MQTT broker.

The recommended setup method is to use the Mosquitto MQTT broker add-on.

Neither ActiveMQ MQTT broker nor the RabbitMQ MQTT Plugin are supported, use a known working broker like Mosquitto instead. There are at least two issues with the ActiveMQ MQTT broker which break MQTT message retention. There is an issue with the RabbitMQ MQTT Plugin which breaks MQTT message retention.


# Example configuration.yaml entry

Configuration Variables

broker string (Optional)

The IP address or hostname of your MQTT broker, e.g.,

port integer (Optional)

The network port to connect to. Default is 1883.

client_id string (Optional)

The client ID that Home Assistant will use. Has to be unique on the server. Default is a randomly generated one.

keepalive integer (Optional)

The time in seconds between sending keep alive messages for this client. Default is 60.

username string (Optional)

The username to use with your MQTT broker.

password string (Optional)

The corresponding password for the username to use with your MQTT broker.

protocol string (Optional)

Protocol to use: 3.1 or 3.1.1. By default it connects with 3.1.1 and falls back to 3.1 if server does not support 3.1.1.

certificate string (Optional)

Path to the certificate file, e.g., /ssl/server.crt.

tls_insecure boolean (Optional, default: false)

Set the verification of the server hostname in the server certificate.

If you are running a Mosquitto instance on a different server with proper SSL encryption using a service like Let’s Encrypt you may have to set the certificate to the operating systems own .crt certificates file. In the instance of Ubuntu this would be certificate: /etc/ssl/certs/ca-certificates.crt

Public broker

The Mosquitto project runs a public broker. This is the easiest to set up, but there is no privacy as all messages are public. Use this only for testing purposes and not for real tracking of your devices or controlling your home.

  port: 1883 or 8883

  # Optional, replace port 1883 with following if you want encryption
  # (doesn't really matter because broker is public)
  port: 8883
  # Download certificate from
  certificate: /home/paulus/downloads/

If you experience an error message like Failed to connect due to exception: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed, then add certificate: auto to your broker configuration and restart Home Assistant.