Fabian Affolter 481320128f Re-organisation Documentation and Getting started (#2055)
* Split MQTT documentation

* Add more details

* Move content to /docs

* Enable sidebar

* Move content to /docs

* Enable sidebar

* Move content

* Update links

* Remove wizard stuff

* Enable sidebar

* Minor changes

* Move MQTT parts to /docs

* update links

* Update links and sync content

* Fix link

* Enable sidebar

* Remove navigation

* Remove navigation and other minor updates

* Update links

* Add overview page

* Make title linkable

* Update

* Plit content

* Update links

* Rearrange content

* New getting-started section

* Add icons for docs

* Update for new structure

* Update for new structure

* Add docs navigation

* Add docs overview page

* Remove ecosystem navigation

* Add docs and remove other collections

* Move ecosystem to docs

* Remove duplicate files

* Re-add ecosystem overview

* Move to ecosystem

* Fix permission

* Update navigation

* Remove collection

* Move overview to right folder

* Move mqtt to upper level

* Move notebook to ecosystem

* Remove un-used files

* Add one more rectangle for iOS

* Move two parts back from docs and rename Run step

* Remove colon

* update getting-started section

* Add redirect

* Update

* Update navigation
2017-02-23 11:09:41 +01:00

5.1 KiB

layout, title, description, date, sidebar, comments, sharing, footer, logo, redirect_from
layout title description date sidebar comments sharing footer logo redirect_from
page MQTT Brokers Instructions how to setup MQTT brokers for Home Assistant. 2015-08-07 18:00 true false true true mqtt.png /components/mqtt/#picking-a-broker

The MQTT component needs you to run an MQTT broker for Home Assistant to connect to. There are four options, each with various degrees of ease of setup and privacy.

{% linkable_title Embedded broker %}

Home Assistant contains an embedded MQTT broker. If no broker configuration is given, the HBMQTT broker is started and Home Assistant connects to it. Embedded broker default configuration:

Setting Value
Host localhost
Port 1883
Protocol 3.1.1
User homeassistant
Password Your API password
Websocket port 8080
# Example configuration.yaml entry
mqtt:

This broker does not currently work with OwnTracks because of a protocol version issue.

If you want to customize the settings of the embedded broker, use embedded: and the values shown in the HBMQTT Broker configuration. This will replace the default configuration.

# Example configuration.yaml entry
mqtt:
  embedded:
    # Your HBMQTT config here. Example at:
    # http://hbmqtt.readthedocs.org/en/latest/references/broker.html#broker-configuration

{% linkable_title Run your own %}

This is the most private option but requires a bit more work. There are multiple free and open-source brokers to pick from: eg. Mosquitto, EMQ, or Mosca.

# Example configuration.yaml entry
mqtt:
  broker: 192.168.1.100
  port: 1883
  client_id: home-assistant-1
  keepalive: 60
  username: USERNAME
  password: PASSWORD
  protocol: 3.1 

Configuration variables:

  • broker (Optional): The IP address or hostname of your MQTT broker, e.g. 192.168.1.32.
  • port (Optional): The network port to connect to. Default is 1883.
  • client_id (Optional): The client ID that Home Assistant will use. Has to be unique on the server. Default is a randomly generated one.
  • keepalive (Optional): The time in seconds between sending keep alive messages for this client. Default is 60.
  • username (Optional): The username to use with your MQTT broker.
  • password (Optional): The corresponding password for the username to use with your MQTT broker.
  • protocol (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.

There is an issue with the Mosquitto package included in Ubuntu 14.04 LTS. Specify `protocol: 3.1` in your MQTT configuration to work around this issue.

If you are running a mosquitto instance on a different server with proper SSL encryption using a service like letsencrypt 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`

{% linkable_title 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.

mqtt:
  broker: test.mosquitto.org
  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 http://test.mosquitto.org/ssl/mosquitto.org.crt
  certificate: /home/paulus/downloads/mosquitto.org.crt

{% linkable_title CloudMQTT %}

CloudMQTT is a hosted private MQTT instance that is free for up to 10 connected devices. This is enough to get started with for example OwnTracks and give you a taste of what is possible.

Home Assistant is not affiliated with CloudMQTT nor will receive any kickbacks.

  1. Create an account (no payment details needed)
  2. Create a new CloudMQTT instance (Cute Cat is the free plan)
  3. From the control panel, click on the Details button.
  4. Create unique users for Home Assistant and each phone to connect
    (CloudMQTT does not allow two connections from the same user)
    1. Under manage users, fill in username, password and click add
    2. Under ACLs, select user, topic #, check 'read access' and 'write access'
  5. Copy the instance info to your configuration.yaml:
mqtt:
  broker: CLOUTMQTT_SERVER
  port: CLOUDMQTT_PORT
  username: CLOUDMQTT_USER
  password: CLOUDMQTT_PASSWORD

Home Assistant will automatically load the correct certificate if you connect to an encrypted channel of CloudMQTT (port range 20000-30000).