Home Assistant Community Add-on: MQTT Server & Web client

I have the same issue. I simply cannot get the webui to connect to the broker.
All my other MQTT clients will connect fine (port 1883 no SSL).

My config is: (v1.1.0)

{
  "ssl": false,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "broker": true,
  "allow_anonymous": false,
  "mqttusers": [
    {
      "username": "xxxx",
      "password": "yyyy",
      "readonly": false,
      "topics": [
        "#"
      ]
    },
    {
      "username": "aaaa",
      "password": "bbbb",
      "readonly": false,
      "topics": [
        "#"
      ]
    }
  ],
}

I tried port 1884 without SSL, which does nothing.
And I tried port 4884 with SSL which gives error:

Connect failed: AMQJS0007E Socket error:undefined.

I see no logs for any login attempts with the client ID I specified.

What host do you use?

I tried both the internal host name of my hassio VM (hassio.local) and it’s IP address. I did not use the external fqdn (homeassistant.mydomain.com) because this resolves to my external ip and I don’t expose my mqtt broker externally.

do you use https when accessing the web client?

It’s exposed via ingress - show in sidebar is turned on and I’m opening the ui from the sidebar

do you use https when accessing the web client? :slight_smile:

if you do, you need the broker to run SSL as well, and expose it or use split DNS so it can verify that certificate.

Ah OK. Got you.
Looks like I will not use the web UI and use another mqtt client instead as I have been doing.
Thanks for the help.

Champion!!!

Thanks, @Skeletorjus I had the same problem - I had to do it twice for it to stick but looks like ti is stable now.

Hello everyone, I run my Hassio on a raspberry pi zero w and after this update I have encountered problems with this addon, I always have this error log:

[s6-init] making available files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms … exited 0.
[fix-attrs.d] applying ownership & permissions fixes …
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts …
[cont-init.d] 00-banner.sh: executing …
[cont-init.d] 00-banner.sh: exited 267.
[cont-finish.d] executing container finish scripts …
[cont-finish.d] 99-message.sh: executing …
s6-maximumtime: warning: child process crashed
[cont-finish.d] 99-message.sh: exited 111.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

would the addon incompatibility with my Pi zero w?

That is from the base image, can you run any community addon?

I’m looking for some guidance on how to connect to the built-in server with the web client. I’m using Nginx Proxy Manager and I’ve set up a proxy host for MQTT. The MQTT addon logs show that it starts without errors. The NPM config is below, I’m forcing SSL, and there is a cert for mqtt.mydomain.duckdns.org:
nginx%20mqtt%20config
When I try to connect to either mydomain.duckdns.org or mqtt.mydomain.duckdns.org over 4884, with the MQTT username and password from the MQTT addon and “Use SSL checked” (as below), I get the “Connect timed out” error:


connect%20timed%20out
Here’s my addon config and open ports (default ports):
mqtt%20addon%20config
mqtt%20addon%20open%20ports
Here’s the relevant section of my configuration.yaml:
mqtt%20configuration%20yaml

Is my issue with my NPM configuration or my MQTT addon configuration? Do I need to specify the path to the same NPM MQTT cert in the MQTT addon?

Update: tried some things and made some progress. Thinking that my issue was SSL-related, I changed the addon to run on port 5713 and I disabled SSL (since I use Nginx Proxy Manager to manager my certs). At this point, I can access the web client at 192.168.xx.xxx:5713, the MQTT server is running, and HA and my one MQTT device can connect and publish messages. I can access the addon at mqtt.mydomain.duckdns.org but since I’m accessing the addon via HTTPS, I’m not surprised that I can’t connect to my MQTT server through the web UI, per post #200. Ultimately, my goal is to be able to use the addon to connect to the MQTT server over the internet (i.e. not only within my home network).

Reading the addon documentation, it says the cert/keyfile “MUST be stored in /ssl/” but since I use Nginx Proxy Manager, mine are not stored at /ssl/ but in a subfolder /ssl/nginxproxymanager. Setting the path to the fullchain.pem and privkey.pem returns this error:
sed: bad option in substitution expression
which appears to be due to the “/” in the “/nginxproxymanager/…/…/fullchain.pem” and privkey.pem paths listed in the addon config. @ludeeus Is there a way to set the cert paths in the addon to reference the NPM certs?

On the add-on log I see a mqtt device connect. But I am not seeing the sensor data on home assistant. Not sure if this is a mosquito broker issue or a device issue. Anyway I can check and see if Hassio is getting the sensor data? just weird how it can connect, and I can see the sensor data in the Arduino serial monitor.

Use mqttspy, the weclient that ships with this or any other mqtt toll to see if the messages are received on the broker, if they are the issue is with your connection between the broker and HA.

Thanks for the reply man. Could not get it to work. Just went to Mosquitto broker add-on and all is working, just thought I would let you know…

Thank you for the help.

Dear I have also gone through this
I changed read only from true to false and it started showing me sensors.

I’ve been trying to get the MQTT broker up and running for hours but I seem to be stuck. I’m running Hass.io on unRAID.

Here is my config file:

{
  "ssl": false,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "broker": true,
  "allow_anonymous": false,
  "mqttusers": [
    {
      "username": "USER",
      "password": "PASSWORD",
      "readonly": true,
      "topics": [
        "#"
      ]
    }
  ]
}

When I start up it up my logs spit out:

[15:46:45] INFO: Starting mosquitto MQTT Server...
1565563605: Error: Unknown configuration variable "{".
1565563605: Error found at /opt/mosquitto.conf:17.

I tried navigating to /opt/ but there aren’t any files in there. Can anyone help me get MQTT running?

I got that config from the official documents (addon-mqtt/README.md at 3c6d596d1888c76d805e981abef9ec7143b051d7 · hassio-addons/addon-mqtt · GitHub):

{
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "broker": true,
  "allow_anonymous": false,
  "mqttusers": [
    {
      "username": "MarryPoppins",
      "password": "Supercalifragilisticexpialidocious",
      "readonly": true,
      "topics": [
        "cmnd/"
      ]
    }
  ]
}

I tried using your config and am unable to save it as the new config. I receive this error:

not a valid value for dictionary value @ data[‘options’]. Got {‘logins’: , ‘anonymous’: False, ‘customize’: {‘active’: True, ‘folder’: ‘mosquitto’}, ‘certfile’: ‘fullchain.pem’, ‘keyfile’: ‘privkey.pem’, ‘quiet_logs’: True}

oops!!! my mistake. I didn’t realise you were talking about the Community Addon, not the core MQTT Broker.

Sorry for that.