My mqtt no longer works since the last HASS update.
I’ve uninstalled and re-installed HASS and mosquitto on the local server but just can’t get it back up and running.
The problem seems to be with the mosquitto set up as a a simple “Hello World” test in putty sometimes works but mainly comes up with an error msg:
“Error: Connection refused”
This is the error code I have on my Home Assistant dev page…
2017-06-28 12:58:10 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
thank you gpbenton
I’ve managed to solve it. while re-installing HA i’ve ended up with a new IP and have to update all my sensors/switches.
All done now and it’s back up and running.
You need to either get your router to always use the same IP for this machine (how to do this depends on your router), or set up a static IP address. Otherwise, you are likely to get a new ip address the next time the machine is rebooted.
I do need to look into how I can assign a static address to devices. I have the same problem with some of my switches, from time to time their IP address change and I have to update by YAML file. Pain in the ass!
I’m learning as I go with this stuff, one more thing to get my head around.
Ah. I don’t think a component is what you need though, as that will only run after HA is running, and at that point the yaml file has already been read. It should be possible to write an ordinary python or bash script to do it outside of HA.
But I think the simplest solution is to buy a new wifi router. Any modern one should be able to do this.
It depends on the capabilities of what you buy. I think most would allow you to use an external DHCP,
I seem to remember that is how I did it when I had this configuration, but that was only after a long time using the DHCP of the Wi-Fi router. I think using the ISP router’s DHCP reduced the number of networks and so looked neater, but it didn’t really have any effect on performance.