Hello all! I’ve tried everything and cannot get my mqtt component to start up within HA.
I followed the instructions here
Everything is on a single raspberrry pi just running raspbian. The MQTT broker (Mosca) is within a docker container that I’ve started and restarted several times while trying to fix this issue. All of the preferences are stock as per the instructions. The port for Mosca is 1883.
The HA configuration.yaml needs to be pointed at the MQTT broker which is either localhost, 127.0.0.1 or the IP of the raspberry pi. The thing is I’ve tried all three with and without specifying the port withing the config.yml as well as the configuration.yaml.
For a second I thought I was being an idiot because when I run ifconfig the docker0 has an ip address as well and I even tried that!
I’m furious because it’s a relatively simple process that I’ve spent hours on due to the lack of documentation. I followed the instructions I linked to the “T”, several times and I’m still stuck.
Here’s the error I’m receiving. (I’ve googled to hell and back).
2017-10-12 02:32:41 ERROR (MainThread) [homeassistant.setup] Error during setup of component mqtt
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/setup.py", line 191, in _async_setup_component
result = yield from component.async_setup(hass, processed_config)
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 387, in async_setup
success = yield from hass.data[DATA_MQTT].async_connect()
File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/mqtt/__init__.py", line 497, in async_connect
self._mqttc.connect, self.broker, self.port, self.keepalive)
File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup
future.result()
File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result
raise self._exception
File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.5/site-packages/paho/mqtt/client.py", line 760, in connect
return self.reconnect()
File "/srv/homeassistant/lib/python3.5/site-packages/paho/mqtt/client.py", line 887, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File "/usr/lib/python3.5/socket.py", line 712, in create_connection
raise err
File "/usr/lib/python3.5/socket.py", line 703, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
My config.yml (located at /opt/mqtt-bridge/config.yml) looks like this:
mqtt:
host: 10.0.0.xxx:1883
In that file I’ve tried the ip address without the port specified, localhost with and without the port specified, 127.0.0.1 with and without the port specified and even tried the ip of the docker container itself, with and without the port specified.
As with the above my configuration.yaml for HA looks like this:
mqtt:
broker: 10.0.0.xxxport: 1883 client_id: home-assistant protocol: 3.1
I know that the config.yml and configuration.yaml information need to match and I’ve tried all of the above from the config.yml with the configuration.yaml as well.
I’m stumped.
EDIT: I ran docker ps -a and I think this may be why I’m having issues as well.
Under status for both containers that were created via the tutorial they both say “Exited (1)”, I’m pretty sure that isn’t supposed to be the case.