MQTT Server & Web client - web client connection problem

I have successfully installed the MQTT Server & Web client onto my pi-based HASS.IO instance.

I can see it is working correctly from the logs in HASS.IO but the web client will not connect. I have the broker running on 1883, with anonymous enabled (while testing). Using the web client, I add the IP address of the server, the port 1833 and a client name (e.g. test) but when I click ‘connect’ nothing happens.

I’ve also tried it with a username and password on the client settings and this also does not work - but I know these credentials are OK as I have another Pi client using them to send messages.

Any idea what I am doing wrong please?

I have just noticed that the log displays the following error when I try to connect from the web client:

1554185181: New connection from 192.168.121.2 on port 1883.
1554185181: Socket error on client <unknown>, disconnecting.

Any ideas why I am getting this, please?

Web client is port 1884

Thank you @DavidFW1960 - unfortunately that does not work either, but does not add a log entry.

Config of the server is as follows:

{
  "log_level": "debug",
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "web": {
    "enabled": true,
    "ssl": false
  },
  "broker": {
    "enabled": true,
    "enable_ws": false,
    "enable_mqtt": true,
    "enable_ws_ssl": false,
    "enable_mqtt_ssl": false,
    "allow_anonymous": true
  },
  "mqttusers": [
    {
      "username": "User01",
      "password": "Password1",
      "readonly": false,
      "topics": [
        "#"
      ]
    }
  ]
}

8713 for the web but then when you connect it’s 1884 in the app…

Thanks again.

Do you mean that the server should be set for 8713 here?
MQTT

No.

http://ipaddress:5713 to access the web terminal. Then when you CONNECT in the app it’s port 1884

Thanks again, David, but it must be too early here and I’ve not had enough coffee yet because I’m not following.

The server and client addresses are set as per the image above. I am using http://serveraddress:8123/mqtt to access the web client. It appears to be working OK except that it does not connect. The web client is the same as this one:

I’ve tried 1883 and 1884 authenticated and non-authenticated.

it’s actually saying it’s connected…

I did give up on this addon because it didn’t like that I was using ssl etc and it was just too hard to make it work. I was getting browser errors as I remember.

But top right says connected with green button…

Sorry, I should have been clearer - that image is from the add-on web page. Mine does not change from red to green with the equivalent settings.

Thanks for sharing the problems you had with it - could I ask what combination you went for in the end for server and client?

Did you try the ipaddress:5713?

I’m using the core addon and if I want to view whats going on (rare unless I’m having a problem) I use MQTT Explorer which is really good for killing any zombies and retained messages.

Because I was using SSL and my duckdns address, the iFram also used ssl and I had to use the local IP address in the HiveMQ screen and then my browser wanted to show everything as not secure and I had to ignore warnings etc and to be honest, the dev wasn’t very helpful and was dripping out information and making obscure statements so it was easier just to use something that works.

5713 in the port address on the web client? Yes, no luck unfortunately.

Thanks for the advice - I may end up going that way if I can’t get this to work properly!

this is from roboform and ignore sonoff down the bottom but this worked in the web interface for me

also make sure you have webserver enabled

Thanks - those settings on mine all appear to be correct. Can’t spend any more time now (must get to work) but will continue this evening.

If I don’t get it sorted quickly I’ll uninstall and look for alternatives.

Thanks again for your help!

Yeah… I just enabled the addon and I get to the login screen and it won’t connect when I click connect… Getting the login interface it just won’t connect to the broker after that…
image

Thanks again - at least it is consistent!

Must dash - will continue later. Have a great day.

1 Like

I found the problem - you must have "enable_ws": true for the web client to work (or, I guess, "enable_ws_ssl": true if you are using SSL)

Set that and added a few users and it seems to be working fine.