Everything was working fine until this yesterday. Then I noticed I couldn’t control my Sonoff lights (MQTT).
I rebooted the Pi and now I get an invalid config for MQTT notification. Checking the log I get the following:
2017-11-12 10:43:55 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 191, 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 387, 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 497, 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 “/srv/homeassistant/lib/python3.4/site-packages/paho/mqtt/client.py”, line 760, in connect
return self.reconnect()
File “/srv/homeassistant/lib/python3.4/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.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
Stranger still is that I haven’t changed anything at all. I haven’t even logged in to the pi with putty or WinSCP in over a month. It was all working ans suddenly MQTT is broken.
This is normally an invalid username or password. Can you connect to your broker with some other client using the username and password in your configuration.yaml?
From this I assume that you are accessing mosquitto through an external connection. If this is encrypted is it possible that your certificate has expired? That would explain the failure without you touching anything.
I can’t be much help with that as my installation is entirely local.
I was just trying to eliminate the most possibilities.
I burned an older version from a backup and I am able to subscribe to the topic on my PC with MQTTFx so it has to be related to my HA setup.
I will reburn the problem version to the SD card and see if the certificate on there has expired. I don’t think it’s related but that makes the most sense right now. Thanks!
Are there any interesting lines in the log file (usually /var/log/mosquitto/mosquitto.log)?
I think I would try configuring mosquitto to work without a username and password, to see if it is some corruption there.
But then removing and reinstalling would probably be best anyway. If you installed using apt-get, make sure you do
sudo apt-get purge mosquitto
as this gets rid of all the configuration files. remove removes the binaries and service but leaves the configuration files, which will leave you with the same problem.
the mosquitto log file is completely empty. But I’m not sure how reliable that file location is since the date on it is december 1969. I did search and didn’t find any other log files.
I think i’m going to uninstall & reinstall and see if that works.