Error during setup of component mqtt

I tried to use the MQTT addon today, but got issues.

Here is my config:

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

Here is the part in the config file:

mqtt:
  broker: core-mosquitto
  username: <username>
  password: !secret mqtt_pass

And here is the error in the error log:

2018-03-01 22:17:24 ERROR (MainThread) [homeassistant.setup] Error during setup of component mqtt
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/homeassistant/setup.py", line 145, in _async_setup_component
    result = yield from component.async_setup(hass, processed_config)
  File "/usr/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 385, in async_setup
    success = yield from hass.data[DATA_MQTT].async_connect()
  File "/usr/lib/python3.6/site-packages/homeassistant/components/mqtt/__init__.py", line 493, in async_connect
    self._mqttc.connect, self.broker, self.port, self.keepalive)
  File "/usr/lib/python3.6/asyncio/futures.py", line 332, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
    future.result()
  File "/usr/lib/python3.6/asyncio/futures.py", line 245, in result
    raise self._exception
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.6/site-packages/paho/mqtt/client.py", line 768, in connect
    return self.reconnect()
  File "/usr/lib/python3.6/site-packages/paho/mqtt/client.py", line 895, in reconnect
    sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
  File "/usr/lib/python3.6/socket.py", line 724, in create_connection
    raise err
  File "/usr/lib/python3.6/socket.py", line 713, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
2018-03-01 22:17:34 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.mqtt. Setup failed for dependencies: mqtt
2018-03-01 22:17:34 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.mqtt: Could not setup all dependencies.

And the addon log:

starting version 3.2.2
1519939794: mosquitto version 1.4.12 (build date 2017-06-01 13:03:48+0000) starting
1519939794: Config loaded from /etc/mosquitto.conf.
1519939794: Opening ipv4 listen socket on port 8883.
1519939794: Opening ipv6 listen socket on port 8883.
1519939794: Warning: Mosquitto should not be run as root/administrator.

Any idea how I can fix this and where it comes from?

The broker part is wrong. It should be:

broker: 192.168.xxx.xxx

Or:

broker: mysite.duckdns.org

I took that from here:

But you installed the Mosquito add-on and you are calling the core mosquitto in the config…

Is that wrong?

I just followed the instruction on the linked page it says at the end:

Where is the issue? Maybe I’m to blind to see it right now :stuck_out_tongue:

I still don’t see the issue. It was described like that on the addon page…

I mean is the addon page wrong or what’s the issue?

And did you tried changing the broker as i told you?

Broker was correct, but since I used the ssl option and disabled the plain mode, I needed to set the port to 8883

1 Like

image

I’m getting that error…any tips?

Have a look here