Setting up MQTT on Hass.io

I am very green when it comes to Hass.io and in my 2 short weeks of starting I have,
a) Installed Hass.io on an Ubuntu 16.04 server (dedicated to Hass.io)
b) Got the Random counter and notifier running
c) Turned off the random number larger than 10 notifier
d) Got Let’s Encrypt up and running.

Now I am stumped on MQTT. I read the docs, Google’d the ‘heck’ out of it and I’ve managed to understand less now than I did before I started.

I turned on the MQTT Add-on (core-mqtt) and have the config below:

{
  "plain": true,
  "ssl": false,
  "anonymous": false,
  "logins": [
    {
      "username": "my-username",
      "password": "my-password"
    }
  ],
  "customize": {
    "active": false,
    "folder": "mosquitto"
  },
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem"
}

In configuration.yaml I have:

mqtt:
  broker: hass.my-domain.tld
  port: 1883
  username: my-username
  password: my-password
  discovery: true

For the broker: line I started with broker: core-mosquitto so I tried my domain but ended up with the same results on the Overview window when I log into Hass.io:

Invalid config

The following components and platforms could not be set up:

mqtt

Please check your config.

The Add-on Broker says it is running fine and Log in the Add-on shows:

starting version 3.2.2
1526349596: mosquitto version 1.4.12 (build date 2017-06-01 13:03:46+0000) starting
1526349596: Config loaded from /etc/mosquitto.conf.
1526349596: Opening ipv4 listen socket on port 1883.
1526349596: Opening ipv6 listen socket on port 1883.
1526349596: Warning: Mosquitto should not be run as root/administrator.
1526351397: Saving in-memory database to /data/mosquitto.db.

So with the add-on saying it’s running, and that I have a Mosquitto broker setup on another server which has been running just fine for the past 2 months I hope you can understand why I feel I understand less now than I did before I started.

I also just read about a built in Broker and an external broker, that they don’t play well together and the MQTT Broker add-on is an ‘external’ broker. I thought the external broker would be for example the one on my other server and then you would bridge the two brokers together.

You only need one broker on your network. If you have one already set up, then just configure HA to point to that.

gpbenton thanks,

I misunderstood the setup, it’s happening a lot with HA. I thought I was setting up the broker not connecting to a broker.
Put in my existing broker information and Bam the data flowed in and I’ve even setup some zones for Owntracks (which is entirely unstable/inaccurate on Android)

2 Likes