MQTT running on HA

Hi There

I am trying to set up MQTT on my home assistant. I’ve added

mqtt:

to the config.yaml file. When I check the config it comes up with no errors. When I restart HA it says “Invalid config, The following components or platforms could not be setup: MQTT, Please check you config”

Any ideas what im doing wrong here.

Two speculative ideas:

  1. There are some spaces in the next line of the file after mqtt: that are confusing the configuration. Or possibly the error is just in the next configuration section.

  2. You already have an MQTT broker running, which is preventing the HA broker from opening the default port (1883). Or possibly some other network problem is stopping the broker.

thanks for your reply.

I dont have another MQTT broker I am aware of.

I have this on my log file:

2018-03-26 20:56:36 ERROR (MainThread) [hbmqtt.broker] Broker startup failed: [Errno 98] error while attempting to bind on address (‘0.0.0.0’, 8080): address already in use
2018-03-26 20:56:36 ERROR (MainThread) [homeassistant.components.mqtt.server] Error initializing MQTT server
Traceback (most recent call last):
File “uvloop/loop.pyx”, line 1026, in uvloop.loop.Loop._create_server
File “uvloop/handles/streamserver.pyx”, line 43, in uvloop.loop.UVStreamServer.listen
File “uvloop/handles/streamserver.pyx”, line 80, in uvloop.loop.UVStreamServer._fatal_error
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/local/lib/python3.6/site-packages/hbmqtt/broker.py”, line 280, in start
subprotocols=[‘mqtt’])
File “/usr/local/lib/python3.6/site-packages/websockets/server.py”, line 356, in serve
server = yield from loop.create_server(factory, host, port, **kwds)
File “uvloop/loop.pyx”, line 1527, in create_server
File “uvloop/loop.pyx”, line 1030, in uvloop.loop.Loop._create_server
OSError: [Errno 98] error while attempting to bind on address (‘0.0.0.0’, 8080): address already in use

This is the error that is causing the problem. Something already has port 8080 open. I’m not sure why the embedded broker is trying to open it, but it might be something to do with websockets.

Port 8080 is used for something else on my NAS. Shall I use another port number for MQTT

1883 is the port for MQTT. Leave it that way.

I changed the application on my NAS drive that was using port 8080 to something else and now its working, Thanks for your help

1 Like