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

Since you are using SSL, you need to use the domain name for that certificate as the host name

I have tried with and without SSL checked. All have the same error message.

Just checking that will not get you there :wink:

You have not enabled the non SSL port for WebSockets (ws) (1884)

"enable_ws": false,

In a web browser, you can only use websocket ports.
1884 - non SSL
4884 - SSL

1 Like

Got it! I am connected now.

I had to change the client ID so it was different than one the configuration.yaml is using. If I used the same, it would disconnect me immediately.

I’m trying to get this working, but when I open the web UI it’s asking for an username and password. What ever I try I can not authenticate.

Which username and password is required?

EDIT: FYI, the page URL which he is trying to open:
http://hassio.local:5713/mqtt

You home assistant username / password.

Tried that, it’s not accepted somehow…

EDIT:
Restarted the Hassio and tried to get to the webui again, the HA logfile shows:
2019-05-10 20:27:32 ERROR (MainThread) [homeassistant.components.hassio.auth] Can’t find Home Assistant auth.

EDIT2: Solved it.
Because I added, in my configuration.yaml, to get my ssh add-on working:
#https:/github.com/home-assistant/hassos/issues/224
auth_providers:
- type: trusted_networks
trusted_networks:
- 172.16.0.0/12

I remarked this and restarted hassio and now it’s working.

Need to find an other solution for my SSH server add on, I guess…

Another problem. The webui seems unresponsive, when I hit the ‘Connect’ button, nothing happens and nothing is mentioned in the logs…

Only the ‘Add New Topic Subscription’ opens a window, so this seems to be working and collapse ^ is responding.

I’m using Firefox and tried Chrome (under Linux).

Any thoughts?

Open a issue @ github for it, provide the full addon log and screenshots there.

I don’t want to go there, I have other priorities at the moment. I just disable the webui instead and use my Android app for testing (MQTT Dash).

Thanks anyway.

Version v1.1.0

  • BEFORE you upgrade, make sure you read EVERYTHING in this release.
  • BIG shoutout to @frenck for a major refactor of this addon! :heart:
  • You need to have version 0.92.0 of Home Assistant (or newer) to install this update.
  • A link to the web client can be added to the sidebar by toggling “Add to sidebar”

Ingress

This release adds ingress support for the web client, this is enabled as default.

What this means is that if you have bookmarks, iframes, panels, proxy entries, port forwarding or anything else that uses the URL with port number to access the web client those will no longer work with the default configuration.

There is some good news! :slight_smile:

By using ingress, there is no need for a separate login, you don’t need to forward ports, it just works!

Disable ingress

If you do not want to use these new features, you can disable ingress.

To disable ingress add a port in the Network configuration (example 5713) to the right of 80/tcp in the “disabled” field, after adding that hit “SAVE” then restart the addon.

Configuration

The structure of the configuration for this addon has been changed.

Make sure you control all settings and look in the addon log for clues if something fails.

  • You can no longer disable the web client.
  • The ssl option is now “global”, meaning that it will enable:
    • HTTPS for the web client.
    • Port 4883 (MQTT with SSL) on the broker.
    • Port 4884 (Websockets with SSL) on the broker.

Changes

Now that the important changes are taken care of, let’s list the “boring” stuff.

New functionality

  • Ingress support
  • “Add to sidebar” support
  • Get the hostname from your browser automatically.

Version updates

What From To
mosquitto 1.5.8 1.6.2
nginx 1.14.2-r0 1.14.2-r1
lua-resty-http 0.12-r1 0.13-r0
nginx-mod-http-lua 1.14.2-r0 1.14.2-r1
base image 3.0.1 3.1.0

Full changelog

One last thing

Thanks again to @frenck for adding/changing most of what is in this release!

Just a quick tip if there’s someone else like me experiencing that the addon fails after this update with the log spamming

[11:56:41] INFO: Starting mosquitto MQTT Server...
1557741401: Error: Unable to open config file /opt/mosquitto.conf.

I fixed this by stopping the addon, clicking the “save”-button under config, and restarting the addon.

4 Likes

same happened to me, thnx for posting

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.