hassio-addons / addon-mqtt

MQTT Server & Web client - Home Assistant Community Add-ons
https://addons.community
MIT License
35 stars 15 forks source link

Connect failed: AMQJS0007E Socket error:undefined. #12

Closed gieljnssns closed 5 years ago

gieljnssns commented 5 years ago

Problem/Motivation

I'm trying to connect to the server via the web interface. error Connect failed: AMQJS0007E Socket error:undefined. see https://github.com/hassio-addons/addon-mqtt/issues/6

schermafbeelding 2018-11-26 om 11 12 30 schermafbeelding 2018-11-26 om 11 06 10

my config:

{
  "log_level": "info",
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "web": {
    "enabled": true,
    "ssl": true
  },
  "broker": {
    "enabled": true,
    "enable_ws": true,
    "enable_mqtt": true,
    "enable_ws_ssl": false,
    "enable_mqtt_ssl": false,
    "allow_anonymous": false
  },
  "mqttusers": [
    {
      "username": "!secret mqtt_username",
      "password": "!secret mqtt_password",
      "readonly": false,
      "topics": [
        "#"
      ]
    }
  ]
}
addons-assistant[bot] commented 5 years ago

:wave: Thanks for opening your first issue here! If you're reporting a :bug: bug, please make sure you include steps to reproduce it. Also, logs, error messages and information about your hardware might be usefull.

ludeeus commented 5 years ago

Can you paste the entire addon log?

gieljnssns commented 5 years ago
[s6-init] making user provided 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... 

-----------------------------------------------------------
 Hass.io Add-on: MQTT Server & Web client v0.2.2

 Mosquitto MQTT Server bundled with Hivemq's web client

 From: Community Hass.io Add-ons
 By: Franck Nijhof <frenck@addons.community>
-----------------------------------------------------------
 amd64 / Ubuntu 18.04.1 LTS / HA 0.82.1 / SU 140 / stable
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 

INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 10-requirements.sh: executing... 
[cont-init.d] 10-requirements.sh: exited 0.
[cont-init.d] 11-patches.sh: executing... 
patching file /app/index.html
[cont-init.d] 11-patches.sh: exited 0.
[cont-init.d] 20-mqtt_broker.sh: executing... 
INFO: Adding configuration for MQTT Server...
INFO: Setting configuration for websockets...
INFO: Setting configuration for mqtt...
[cont-init.d] 20-mqtt_broker.sh: exited 0.
[cont-init.d] 21-mqtt_web.sh: executing... 
[cont-init.d] 21-mqtt_web.sh: exited 0.
[cont-init.d] 40-nginx.sh: executing... 
[cont-init.d] 40-nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
INFO: Starting mosquitto MQTT Server...
1543304961: mosquitto version 1.4.15 (build date 2018-03-04 15:14:46+0000) starting
1543304961: Config loaded from /opt/mosquitto.conf.
1543304961: Opening websockets listen socket on port 1884.
1543304961: Opening ipv4 listen socket on port 1883.
1543304961: Opening ipv6 listen socket on port 1883.
INFO: Starting NGINX for the MQTT client...
2018/11/27 08:49:21 [notice] 990#990: using the "epoll" event method
2018/11/27 08:49:21 [notice] 990#990: nginx/1.14.1
2018/11/27 08:49:21 [notice] 990#990: OS: Linux 4.15.0-39-generic
2018/11/27 08:49:21 [notice] 990#990: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2018/11/27 08:49:21 [notice] 990#990: start worker processes
2018/11/27 08:49:21 [notice] 990#990: start worker process 1059
1543304961: New connection from 192.168.0.35 on port 1883.
1543304961: Client pi-mqtt-gpio-e83249bd3ba79932e16fb1fb5100dafade9954c2 disconnected.
1543304961: New client connected from 192.168.0.35 as pi-mqtt-gpio-e83249bd3ba79932e16fb1fb5100dafade9954c2 (c0, k60, u'hass').
1543304961: New connection from 172.30.32.1 on port 1883.
1543304962: Socket error on client <unknown>, disconnecting.
1543304962: New connection from 172.30.32.1 on port 1883.
1543304962: New client connected from 172.30.32.1 as c33528cf-66c8-43c9-b7de-141a789d48b6 (c1, k60, u'hass').
1543304975: New connection from 192.168.0.58 on port 1883.
1543304975: New client connected from 192.168.0.58 as keuken_test-84f3eb534b91 (c1, k15, u'hass').
2018/11/27 08:49:52 [info] 1059#1059: *4 [lua] ha-auth.lua:59: authenticate(): Authenticated user against Home Assistant., client: 192.168.0.28, server: _, request: "GET /css/style.css HTTP/1.1", host: "192.168.0.54:5713", referrer: "https://192.168.0.54:5713/"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /css/style.css HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /js/jquery.minicolors.min.js HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /js/encoder.js HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /js/app.js HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /config.js HTTP/1.1" 200 44 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /assets/logo.png HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /assets/arrow_up.png HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
192.168.0.28 - giel [27/Nov/2018:08:49:52 +0100] "GET /assets/arrow_down.png HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
2018/11/27 08:49:53 [info] 1059#1059: *8 [lua] ha-auth.lua:59: authenticate(): Authenticated user against Home Assistant., client: 192.168.0.28, server: _, request: "GET /js/mqttws31.js HTTP/1.1", host: "192.168.0.54:5713", referrer: "https://192.168.0.54:5713/"
192.168.0.28 - giel [27/Nov/2018:08:49:53 +0100] "GET /js/mqttws31.js HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
2018/11/27 08:49:53 [info] 1059#1059: *7 [lua] ha-auth.lua:59: authenticate(): Authenticated user against Home Assistant., client: 192.168.0.28, server: _, request: "GET /css/normalize.css HTTP/1.1", host: "192.168.0.54:5713", referrer: "https://192.168.0.54:5713/"
192.168.0.28 - giel [27/Nov/2018:08:49:53 +0100] "GET /css/normalize.css HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
2018/11/27 08:49:53 [info] 1059#1059: *1 [lua] ha-auth.lua:59: authenticate(): Authenticated user against Home Assistant., client: 192.168.0.28, server: _, request: "GET / HTTP/1.1", host: "192.168.0.54:5713"
192.168.0.28 - giel [27/Nov/2018:08:49:53 +0100] "GET / HTTP/1.1" 200 14003 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
2018/11/27 08:49:53 [info] 1059#1059: *5 [lua] ha-auth.lua:59: authenticate(): Authenticated user against Home Assistant., client: 192.168.0.28, server: _, request: "GET /css/jquery.minicolors.css HTTP/1.1", host: "192.168.0.54:5713", referrer: "https://192.168.0.54:5713/"
192.168.0.28 - giel [27/Nov/2018:08:49:53 +0100] "GET /css/jquery.minicolors.css HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
2018/11/27 08:49:53 [info] 1059#1059: *6 [lua] ha-auth.lua:59: authenticate(): Authenticated user against Home Assistant., client: 192.168.0.28, server: _, request: "GET /css/foundation.css HTTP/1.1", host: "192.168.0.54:5713", referrer: "https://192.168.0.54:5713/"
192.168.0.28 - giel [27/Nov/2018:08:49:53 +0100] "GET /css/foundation.css HTTP/1.1" 304 0 "https://192.168.0.54:5713/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0.1 Safari/605.1.15"
neuman1812 commented 5 years ago

Im getting the same error

Here's my config:

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

Log https://hastebin.com/qeteloyiqi.makefile

hastebin
ludeeus commented 5 years ago

@gieljnssns @neuman1812 When you use SSL for the website you must connect to an SSL WebSocket port(4884).

neuman1812 commented 5 years ago

@gieljnssns @neuman1812 When you use SSL for the website you must connect to an SSL WebSocket port(4884).`

I was uable to get this to work regardless of what port I used or tried combination of. so I modified my config and removed all mention of SSL in the options that I could find.

{
  "log_level": "info",
  "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": false
  },
  "mqttusers": [
    {
      "username": "xxx",
      "password": "xxx",
      "readonly": true,
      "topics": [
        "#"
      ]
    }
  ]
}

Im still receiving the error. There doesn't seem to be any mention of what is causing it in the logs. This is the full log after receiving the error.

[s6-init] making user provided 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... 
-----------------------------------------------------------
 Hass.io Add-on: MQTT Server & Web client v0.2.2
 Mosquitto MQTT Server bundled with Hivemq's web client
 From: Community Hass.io Add-ons
 By: Franck Nijhof <frenck@addons.community>
-----------------------------------------------------------
 armhf / HassOS 1.13 / HA 0.82.1 / SU 140 / stable
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] 02-updates.sh: executing... 
INFO: You are running the latest version of this add-on
[cont-init.d] 02-updates.sh: exited 0.
[cont-init.d] 10-requirements.sh: executing... 
[cont-init.d] 10-requirements.sh: exited 0.
[cont-init.d] 11-patches.sh: executing... 
patching file /app/index.html
[cont-init.d] 11-patches.sh: exited 0.
[cont-init.d] 20-mqtt_broker.sh: executing... 
INFO: Adding configuration for MQTT Server...
INFO: Setting configuration for mqtt...
[cont-init.d] 20-mqtt_broker.sh: exited 0.
[cont-init.d] 21-mqtt_web.sh: executing... 
[cont-init.d] 21-mqtt_web.sh: exited 0.
[cont-init.d] 40-nginx.sh: executing... 
[cont-init.d] 40-nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
INFO: Starting mosquitto MQTT Server...
1543942160: mosquitto version 1.4.15 (build date 2018-03-04 15:35:59+0000) starting
1543942160: Config loaded from /opt/mosquitto.conf.
1543942160: Opening ipv4 listen socket on port 1883.
1543942160: Opening ipv6 listen socket on port 1883.
INFO: Starting NGINX for the MQTT client...
2018/12/04 11:49:22 [notice] 849#849: using the "epoll" event method
2018/12/04 11:49:22 [notice] 849#849: nginx/1.14.1
2018/12/04 11:49:22 [notice] 849#849: OS: Linux 4.14.81-v7
2018/12/04 11:49:22 [notice] 849#849: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2018/12/04 11:49:22 [notice] 849#849: start worker processes
2018/12/04 11:49:22 [notice] 849#849: start worker process 919
1543942167: New connection from 192.168.1.155 on port 1883.
1543942167: New client connected from 192.168.1.155 as LivingRoomLmp2 (c1, k15, u'sonoff').
1543942167: New connection from 192.168.1.153 on port 1883.
1543942167: New client connected from 192.168.1.153 as BarOverHead (c1, k10, u'sonoff').
1543942167: New connection from 192.168.1.157 on port 1883.
1543942167: New client connected from 192.168.1.157 as 3rdFloorAC (c1, k15, u'sonoff').
1543942167: New connection from 192.168.1.152 on port 1883.
1543942167: New client connected from 192.168.1.152 as Barlamp2 (c1, k15, u'sonoff').
1543942167: New connection from 192.168.1.170 on port 1883.
1543942167: New client connected from 192.168.1.170 as PorchXmasLights (c1, k10, u'sonoff').
1543942167: New connection from 192.168.1.154 on port 1883.
1543942167: New client connected from 192.168.1.154 as LivingRoomLmp1 (c1, k15, u'sonoff').
1543942167: New connection from 192.168.1.156 on port 1883.
1543942167: New client connected from 192.168.1.156 as LivingRoomLmp3 (c1, k15, u'sonoff').
1543942167: New connection from 192.168.1.151 on port 1883.
1543942167: New client connected from 192.168.1.151 as Barlamp1 (c1, k15, u'sonoff').
ludeeus commented 5 years ago

And how does the options in the webclient look like @neuman1812 ?

neuman1812 commented 5 years ago

You can close this for me. I switched over to hassbian. I am no longer using hassio and have no need to the add-on.

addons-assistant[bot] commented 5 years ago

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.