MQTT not working after update to 0.43.0

Hi all,
I just updated to 0.43.0 and MQTT is not working anymore with HA.

I got this message in the log:

17-04-22 13:08:43 ERROR (MainThread) [homeassistant.setup] Not initializing mqtt because could not install dependency paho-mqtt==1.2.2
17-04-22 13:08:43 ERROR (MainThread) [homeassistant.setup] Setup failed for mqtt: Could not install all requirements.
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of switch.mqtt. Setup failed for dependencies: mqtt
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.mqtt: Could not setup all dependencies.
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of switch.mqtt. Setup failed for dependencies: mqtt
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.mqtt: Could not setup all dependencies.
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.mqtt. Setup failed for dependencies: mqtt
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.mqtt: Could not setup all dependencies.
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.mqtt. Setup failed for dependencies: mqtt
17-04-22 13:08:48 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.mqtt: Could not setup all dependencies.

Mosquitto seems running fine

● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
   Loaded: loaded (/etc/init.d/mosquitto)
   Active: active (running) since Sat 2017-04-22 13:07:02 CEST; 7min ago
  Process: 251 ExecStart=/etc/init.d/mosquitto start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/mosquitto.service
           └─268 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Apr 22 13:07:01 HA_chip systemd[1]: Starting LSB: mosquitto MQTT v3.1 messa.....
Apr 22 13:07:02 HA_chip systemd[1]: Started LSB: mosquitto MQTT v3.1 messag...r.
Apr 22 13:07:03 HA_chip mosquitto[251]: Starting network daemon:: mosquitto.
Hint: Some lines were ellipsized, use -l to show in full.

Any ideas?

It seems that your system has trouble to install the dependency. Try (in your venv if needed):

$ pip3 install --upgrade paho-mqtt==1.2.2
3 Likes

Thanks a lot @fabaff. It worked!

I am getting this error. Any ideas?

Collecting paho-mqtt==1.2.2
Using cached paho-mqtt-1.2.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-build-xo2mnoxm/paho-mqtt/setup.py”, line 11, in
readme = readme_file.read()
File “/usr/lib/python3.4/encodings/ascii.py”, line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0xe2 in position 12: ordinal not in range(128)

----------------------------------------

Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-build-xo2mnoxm/paho-mqtt/

I had that error too, I fixed it by installing locales

apt-get install locales

then

locale-gen en_US en_US.UTF-8 

and finally

dpkg reconfigure locales

Hope this helps.

I tried that but did not work.

I had to go into the py file and change the paho-mqtt requirement from 1.2.2 to 1.2.3. Everything is working now. Thanks

This worked for me, I changed it in the file ./components/mqtt/init.py

I searched for it with sudo find -iname “*.py” | xargs grep -i mqtt

1.2.2 would work better than mqtt.

my mqtt has stopped working after the last update (0.47 I think) and I get the errors below:

The following errors have been logged this session:

2017-06-25 15:17:14 ERROR (MainThread) [homeassistant.setup] Error during setup of component mqtt
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/setup.py”, line 187, in _async_setup_component
result = yield from component.async_setup(hass, processed_config)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/init.py”, line 377, in async_setup
success = yield from hass.data[DATA_MQTT].async_connect()
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/init.py”, line 487, in async_connect
self._mqttc.connect, self.broker, self.port, self.keepalive)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py”, line 700, in connect
return self.reconnect()
File “/home/homeassistant/.homeassistant/deps/paho/mqtt/client.py”, line 822, in reconnect
sock = socket.create_connection((self._host, self._port), source_address=(self._bind_address, 0))
File “/usr/lib/python3.4/socket.py”, line 509, in create_connection
raise err
File “/usr/lib/python3.4/socket.py”, line 500, in create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
2017-06-25 15:17:15 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.mqtt. Setup failed for dependencies: mqtt
2017-06-25 15:17:15 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.mqtt: Could not setup all dependencies.
2017-06-25 15:17:15 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of sensor.mqtt. Setup failed for dependencies: mqtt
2017-06-25 15:17:15 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform sensor.mqtt: Could not setup all dependencies.
2017-06-25 15:17:16 ERROR (MainThread) [homeassistant.setup] Unable to setup dependencies of switch.mqtt. Setup failed for dependencies: mqtt
2017-06-25 15:17:16 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform switch.mqtt: Could not setup all dependencies.

I have tried fabaff’s suggestions but that hasn’t worked. Also testing mqtt in putty gives me error codes too. I’ve re-installed both Hassbian and mosquitto from scratch but get the same errors.

pi@hassbian:~ $ mosquitto_sub -d -u username -P password -t “dev/test”
Error: Connection refused