Hello HA-Community for Vienna!
I have been using HA for almost a year now, and I am very happy with this large community and possibilities!
Recently I have bought an Xiaomi Aquara Gateway an wanted to Integrate it with HA - unfortunately I was running version 53 of HA and it did not have support for it yet.
So I decided to go up-to-date and updated according to
Python 3.6 upgrade of a virtualenv
So I am currently running it on a raspberry pi with Debian Stretch and Python 3.6.3 Installed running HA 60.1 in an venv also at Python 3.6.3. Mosquitto is up-to-date
Everything is working just fine and like before when I start HA from console with:
sudo su -s /bin/bash homeassistant
cd /srv/homeassistant
source bin/activate
hass
MQTT Component properly initializes and works properly with my devices
However I followed up this guide to setup autostart Autostart using systemd
And now HA cant initalize the MQTT Components.
First I thought Mosquitto isn’t set up in time before HA, but in the mosquitto.service systemD I have
After=xdk-daemon.service
Before=home-assistant.service
And in the home-assistant.service I have:
After=network.target mosquitto.service
After fresh reboot
sudo systemctl status mosquitto.service
and
sudo systemctl status home-assistant.service
both return me “active” where mosquitto always has a lower PID than HA. So I assume Mosquitto IS starting before HA.
I have no clue why HA wont initalize the MQTT Component… I hope you guys know a solution.
I already tried reinstalling Mosquitto+Client and removing an setting up again both systemd for HA and Mosquitto.
Here is what is logged from HA:
[Errno 101] Network is unreachable
2018-01-19 12:17:13 ERROR (MainThread) [homeassistant.setup] Error during setup of component mqtt
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 190, in _async_setup_component
result = yield from component.async_setup(hass, processed_config)
File "/srv/homeassistant/lib/python3.6/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.6/site-packages/homeassistant/components/mqtt/__init__.py", line 498, in async_connect
self._mqttc.connect, self.broker, self.port, self.keepalive)
File "/usr/local/lib/python3.6/asyncio/futures.py", line 332, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/local/lib/python3.6/asyncio/futures.py", line 245, in result
raise self._exception
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/paho/mqtt/client.py", line 768, in connect
return self.reconnect()
File "/srv/homeassistant/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/local/lib/python3.6/socket.py", line 724, in create_connection
raise err
File "/usr/local/lib/python3.6/socket.py", line 713, in create_connection
sock.connect(sa)
**OSError: [Errno 101] Network is unreachable**