0.47 mqtt error

how to solve? Thanks

2017-06-18 12:16:59 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

Broker running? Configuration correct?

Same problem

same problem too

somehow mosquitto doesn’t start by itself anymore:

pi@pi:~ $ sudo systemctl status mosquitto +l
â—Ź mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; disabled)
Active: inactive (dead)
Docs: man:mosquitto(8)
https://mosquitto.org/

â—Ź \x2bl.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
pi@pi:~ $ sudo systemctl start mosquitto
pi@pi:~ $ sudo systemctl status mosquitto +l
â—Ź mosquitto.service - Mosquitto MQTT Broker
Loaded: loaded (/lib/systemd/system/mosquitto.service; disabled)
Active: active (running) since Mon 2017-06-19 23:29:10 EDT; 1s ago
Docs: man:mosquitto(8)
https://mosquitto.org/
Main PID: 1894 (mosquitto)
CGroup: /system.slice/mosquitto.service
└─1894 /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf

Jun 19 23:29:10 pi systemd[1]: Started Mosquitto MQTT Broker.
Jun 19 23:29:10 pi mosquitto[1894]: 1497929350: mosquitto version 1.4.12 (build date Thu, 25 May 2017 22:38:16 +0100) starting
Jun 19 23:29:10 pi mosquitto[1894]: 1497929350: Config loaded from /etc/mosquitto/mosquitto.conf.
Jun 19 23:29:10 pi mosquitto[1894]: 1497929350: Opening websockets listen socket on port 9001.
Jun 19 23:29:10 pi mosquitto[1894]: 1497929350: Opening ipv4 listen socket on port 1883.
Jun 19 23:29:10 pi mosquitto[1894]: 1497929350: Opening ipv6 listen socket on port 1883.

â—Ź \x2bl.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)

Starting it manually solve the issue, but it won’t start after a reboot.

The same mqtt error after upgrade 0.47

2017-06-20 20:15:52 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 364, in async_setup
    will_message, birth_message, tls_version)
  File "/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/mqtt/__init__.py", line 440, in __init__
    proto = mqtt.MQTTv311
AttributeError: 'module' object has no attribute 'MQTTv311'

Any help is apprechiated.

I’m also experiencing problems after upgrade.

There is an update for the MQTT client module pending at the moment. Perhaps will help as I’m not able to reproduce the issue.

i was able to get mosquitto to run at start up by adding mosquitto -d to etc/rc.local

not sure why it stopped in the first place or why reinstalling mosquitto didnt fix it. may have something to do with being on hassbian running sudo apt-get update and upgrade then updating to the new release all in about an hour of each other. ran absolute havoc on my mqtt switches and sensors though.

do we have an update on this issue please?

Check in this forum, there is a similar thread with the solution. I am on cell phone now

I saw this in one forum but couldn’t find the link again. Got it working by below method if the service is not starting. You can try -
sudo update-rc.d mosquitto remove
sudo nano /etc/systemd/system/mosquitto.service

Paste and save this script

[Unit]
Description=Mosquitto MQTT Broker
Documentation=man:mosquitto(8)
Documentation=man:mosquitto.conf(5)
ConditionPathExists=/etc/mosquitto/mosquitto.conf
After=xdk-daemon.service

[Service]
ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf
ExecReload=/bin/kill -HUP $MAINPID
User=mosquitto
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

sudo systemctl enable mosquitto.service

sudo reboot

check if mosquitto is running
sudo mosquitto -v

1 Like

found

Mosquitto won’t start on on boot after the upgrade. To enable it on boot use the following command:

sudo systemctl enable mosquitto.service
then

sudo systemctl start mosquitto.service

4 Likes

I confirm it worked for me. Thank you!

thanks all working

I tried the solution proposed by Claudio but still get this error
pi@hassbian:~ $ sudo mosquitto -v
1498377253: mosquitto version 1.3.4 (build date 2014-08-22 06:10:51+0000) starting
1498377253: Using default config.
1498377253: Opening ipv4 listen socket on port 1883.
1498377253: Error: Address already in use
pi@hassbian:~ $

Tried with netstat to find any other process on port 1883, but it did not show me any.
Any idea how to solve this?

Finaly after installing version 0.47.1 again, mqtt works fine again.
Problem solved.