hassio-addons/addon-mqtt

Connect failed: AMQJS0007E Socket error:undefined.

neuman1812 opened this issue · 7 comments

Problem/Motivation

unable to access the WebUI

Expected behavior

access the webUI

Actual behavior

Connect failed: AMQJS0007E Socket error:undefined.

Steps to reproduce

Install mqtt AddOn. Provide following Config options

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

Tested Broker IP or hostname with: ipaddress, hostname, URL(duckdns) Tried port 4884 and 1884. SSL option yes. Client ID: hassio-mqtt-client

SSL would be on 4884, and does the certificate used match the hostname used?

What does your client resolve the name to?, please consider that the web client is from the browser to the server.

What does your client resolve the name to?,

Please forgive me. New to HassIO and MQTT: Im not sure what specifically you are looking for when you say "client". machine name? My duckdns URL? IP address?

as far as certificate, I can access my home assistant url with https:://xxx.duckdns.org name. So I believe the certificate is setup correctly with Letsencrypt, if thats what your asking.

Essentially, if your client (i.e. browser), resolves the duckdns url to your external address, that is what it will try to connect on. Unless your router supports hairpin NAT, or you use some form of split DNS, it is likely that you would need to allow that traffic through your router (which I would not recommend).

I am assuming you opened or forwarded the relevant port for HA itself?

You can test this by setting SSL to false, restarting the addon, then connect using the IP address on the standard Websocket port (1884).

The only port I have open for this machine on my router (google wifi) is 8123.

I set it to false and tried the ipaddress without SSL selected. That works

I don't believe that it supports NAT loopback, so when you use your duckdns name, the traffic leaves your router and comes back in (which is why you need the port open).

My recommendation would be to run some form of split dns, probably using Adguard.

I switched to the other mosquito add on and used the mqtt integration . that's working. But thank you for the infirmation.

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.