MQTT not working after upgrade to 0.59.1

I was on V0.54.0 of home assistant and v3.4 of python on Raspbian Jessie.

Upgraded to Raspbian Stretch/Python3.6.3/HA V0.59.1 all at once following the instructions in this thread:

https://community.home-assistant.io/t/python-3-6-upgrade-of-a-virtualenv/21722

I had a few issues that I was able to get resolved but I can’t fix my MQTT.

I have uninstalled it by doing a purge:

$ sudo apt-get purge mosquitto

Then did a reinstall.using the same user name and password as I already had before.

Now I get the following errors:

2017-12-04 05:08:17 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)
ConnectionRefusedError: [Errno 111] Connection refused

Here is my config:

mqtt:
  broker: 192.168.1.125
  port: 1883
  client_id: home-assistant-1
  username: !secret MQTT_user  
  password: !secret MQTT_password

Am I doing something wrong or is there something I’m missing because of the upgrades?

Disregard…

I’m Stupid…

:confused:

:open_mouth: Very brave. Maybe even foolhardy.

I think the first thing to check is that mosquitto is actually running

$ systemctl status mosquitto.service 
● mosquitto.service - LSB: mosquitto MQTT v3.1 message broker
   Loaded: loaded (/etc/init.d/mosquitto; generated; vendor preset: enabled)
   Active: active (running) since Mon 2017-12-04 10:48:10 GMT; 17min ago
     Docs: man:systemd-sysv-generator(8)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/mosquitto.service
           └─530 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Dec 04 10:48:08 graham-lubuntu17 systemd[1]: Starting LSB: mosquitto MQTT v3.1 m
Dec 04 10:48:10 graham-lubuntu17 mosquitto[433]:  * Starting network daemon: mos
Dec 04 10:48:10 graham-lubuntu17 mosquitto[433]:    ...done.
Dec 04 10:48:10 graham-lubuntu17 systemd[1]: Started LSB: mosquitto MQTT v3.1 me

@gpbenton

Yeah, I know. :crazy_face:

It was definitely an adventure. In the end it is all OK now.

And I knew I had a backup. :wink:

As far as MQTT, It was running.

But it’s working now. It couldn’t find the password file because when I configured it I copied and pasted it from another file. And it had a hidden space at the end of the file name "pwfile ". Then to make it worse every time I reinstalled it I did the exact same thing.

I eventually figured it out by looking at the log that you so kindly pointed out the last time I had an MQTT problem. Thanks!

Just for the record this wasn’t the same problem I had last time. That would be really embarrassing. .:grin: That was fixed by a one time reinstall. And I still don’t know what caused it.

1 Like