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" with HiveMQ client #48

Closed nhscott closed 5 years ago

nhscott commented 5 years ago

Problem/Motivation

Receive "Connect failed: AMQJS0007E Socket error:undefined" error when trying to connect to Community Add on MQTT broker through built-in HiveMQ client from all browsers (tried Chrome, Opera and Edge).

Issues #24, #6 and #12 are about the same error message, but neither was actually resolved. One submitter stopped using Hassio, and this addon, while the other managed to connect finally "without changing anything". Both issues are closed.

Expected behavior

HiveMQ client connection to add on broker.

Actual behavior

Connection fails with error message as above.

Steps to reproduce

Fresh install of add on. MQTT broker works and I can see devices connecting to it in logs. Hassio integration set up via configuraton and HA configuration.yaml. Attempted to use the mosquito addon before this and also had issues attempting to connect to the MQTT broker from home assistant (i uninstalled the mosquito addon before swapping to this addon). Error in WEB UI image

MQTT Server & Web client configuration

image

System info

image

System log (when attempting to connect) image

Addon log Log [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 Mosquitto MQTT Server bundled with Hivemq's web client

Add-on version: 1.1.0 You are running the latest version of this add-on. System: HassOS 2.12 (amd64 / intel-nuc) Home Assistant version: 0.97.2 Supervisor version: 181

Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat.

[cont-init.d] 00-banner.sh: exited 0. [cont-init.d] 01-log-level.sh: executing... [cont-init.d] 01-log-level.sh: exited 0. [cont-init.d] hivemq.sh: executing... patching file /app/index.html [cont-init.d] hivemq.sh: exited 0. [cont-init.d] mosquitto.sh: executing... [15:17:20] INFO: Adding configuration for MQTT Server... [15:17:27] INFO: Setting up user (!secret) [15:17:31] INFO: Password is NOT in the Have I Been Pwned database! Nice! [cont-init.d] mosquitto.sh: exited 0. [cont-init.d] nginx.sh: executing... [cont-init.d] nginx.sh: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [15:17:37] INFO: Starting mosquitto MQTT Server... 1566245857: mosquitto version 1.6.2 starting 1566245857: Config loaded from /opt/mosquitto.conf. 1566245857: Opening ipv4 listen socket on port 1883. 1566245857: Opening ipv6 listen socket on port 1883. 1566245857: Opening websockets listen socket on port 1884. 1566245857: Opening ipv4 listen socket on port 4883. 1566245857: Opening ipv6 listen socket on port 4883. 1566245857: Opening websockets listen socket on port 4884. [15:17:38] INFO: Starting NGINX for the MQTT client... nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)

Configuration.yaml

Proposed changes

No idea how to fix this isssue.

GitHub
openresty/luajit2
OpenResty's Branch of LuaJIT 2. Contribute to openresty/luajit2 development by creating an account on GitHub.
OpenResty - Download
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.

sinclairpaul commented 5 years ago

From my understanding its a Websockets connection from your browser, is 4884 accessible?

nhscott commented 5 years ago

Not sure how to test for this. I am new to the home assistant community and I tried searching "how to access ports via websockets" and I got a bit overwelmed.
Im clearly lacking knowledge on the underlying mechanism of how the MQTT client communicates with HASSIO. Is there a resource i can read to become more familar with testing ports accessiblity with websockets?

I also forgot to add my HA configuration

mqtt: broker: a0d7b954-mqtt username: !secret mqtt_user password: !secret mqtt_pass client_id: hassio-mqtt-client

sinclairpaul commented 5 years ago

No problem, the reason for my comment was that I noticed you are accessing via your duckdns domain. Is that resolving to your external address? or did you make if resolve to your internal address?

If it is external did you configure access via port-forwarding? If connect to IP address on 1884 does the web ui work (you may need to disable SSL)?

Just to add, accessing from the webui and from HA are different things are you actually seeing errors in the HA log itself when connecting.

sinclairpaul commented 5 years ago

Looks like you made you way to Discord which is probably the best place to help troubleshoot.

Will close this out.

disrupted commented 5 years ago

I am having the very same issue. did you find a solution?

addons-assistant[bot] commented 4 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.