zigbee2mqtt / hassio-zigbee2mqtt

Official Zigbee2MQTT Home Assistant add-on
https://www.zigbee2mqtt.io
Apache License 2.0
1.02k stars 362 forks source link

No connection to mqtt broker after setup #597

Closed Tockra closed 2 months ago

Tockra commented 2 months ago

Description of the issue

I did following steps:

  1. Install Mosquitto broker Current version: 6.4.0 (Änderungsprotokoll) -> Start it. Logs:
    s6-rc: info: service s6rc-oneshot-runner: starting
    s6-rc: info: service s6rc-oneshot-runner successfully started
    s6-rc: info: service fix-attrs: starting
    s6-rc: info: service fix-attrs successfully started
    s6-rc: info: service legacy-cont-init: starting
    cont-init: info: running /etc/cont-init.d/mosquitto.sh
    parse error: Expected string key before ':' at line 1, column 4
    [19:19:08] ERROR: Unknown HTTP error occured
    jq: error (at <stdin>:1): null (null) has no keys
    [19:19:08] INFO: SSL is not enabled
    cont-init: info: /etc/cont-init.d/mosquitto.sh exited 0
    cont-init: info: running /etc/cont-init.d/nginx.sh
    cont-init: info: /etc/cont-init.d/nginx.sh exited 0
    s6-rc: info: service legacy-cont-init successfully started
    s6-rc: info: service legacy-services: starting
    services-up: info: copying legacy longrun mosquitto (no readiness notification)
    services-up: info: copying legacy longrun nginx (no readiness notification)
    [19:19:08] INFO: Starting NGINX for authentication handling...
    [19:19:08] INFO: Starting mosquitto MQTT broker...
    2024-04-16 19:19:08: Warning: Mosquitto should not be run as root/administrator.
    2024-04-16 19:19:08: mosquitto version 2.0.18 starting
    2024-04-16 19:19:08: Config loaded from /etc/mosquitto/mosquitto.conf.
    2024-04-16 19:19:08: Loading plugin: /usr/share/mosquitto/go-auth.so
    2024-04-16 19:19:08:  ├── Username/password checking enabled.
    2024-04-16 19:19:08:  ├── TLS-PSK checking enabled.
    2024-04-16 19:19:08:  └── Extended authentication not enabled.
    2024-04-16 19:19:08: Opening ipv4 listen socket on port 1883.
    2024-04-16 19:19:08: Opening ipv6 listen socket on port 1883.
    2024-04-16 19:19:08: Opening websockets listen socket on port 1884.
    2024-04-16 19:19:08: mosquitto version 2.0.18 running
    s6-rc: info: service legacy-services successfully started
    2024-04-16 19:19:08: New connection from 127.0.0.1:46938 on port 1883.
    2024-04-16 19:19:08: Client <unknown> disconnected due to protocol error.
    parse error: Expected string key before ':' at line 1, column 4
    [19:19:09] ERROR: Unknown HTTP error occured
    [19:19:09] INFO: Successfully send discovery information to Home Assistant.
    [19:19:09] INFO: Successfully send service information to the Supervisor.
  2. then I installed zigbee2mqtt.
    • I set mqtt: server: mqtt://localhost:1883 and serial: port: /dev/ttyUSB0 then I started
    • Logs:
      [19:21:23] INFO: Preparing to start...
      [19:21:23] INFO: Socat not enabled
      [19:21:24] INFO: Starting Zigbee2MQTT...
      Zigbee2MQTT:info  2024-04-16 19:21:26: Logging to console and directory: '/config/zigbee2mqtt/log/2024-04-16.19-21-26' filename: log.txt
      Zigbee2MQTT:info  2024-04-16 19:21:26: Starting Zigbee2MQTT version 1.36.1 (commit #unknown)
      Zigbee2MQTT:info  2024-04-16 19:21:26: Starting zigbee-herdsman (0.40.3)
      Zigbee2MQTT:info  2024-04-16 19:21:26: zigbee-herdsman started (resumed)
      Zigbee2MQTT:info  2024-04-16 19:21:26: Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20210708,"transportrev":2},"type":"zStack3x0"}'
      Zigbee2MQTT:info  2024-04-16 19:21:26: Currently 0 devices are joined:
      Zigbee2MQTT:info  2024-04-16 19:21:26: Zigbee: disabling joining new devices.
      Zigbee2MQTT:info  2024-04-16 19:21:26: Connecting to MQTT server at mqtt://localhost:1883
      Zigbee2MQTT:error 2024-04-16 19:21:26: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:26: MQTT failed to connect, exiting...
      Zigbee2MQTT:info  2024-04-16 19:21:26: Stopping zigbee-herdsman...
      Zigbee2MQTT:error 2024-04-16 19:21:27: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:28: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:29: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:30: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:31: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:32: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:33: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:error 2024-04-16 19:21:34: MQTT error: connect ECONNREFUSED 127.0.0.1:1883
      Zigbee2MQTT:info  2024-04-16 19:21:35: Stopped zigbee-herdsman

In the meanwhile Mosquitto shows:

2024-04-16 19:20:51: New connection from 172.30.32.2:46786 on port 1883.
2024-04-16 19:20:51: Client <unknown> closed its connection.

Addon version

1.36.1-1

Platform

Home Assistant

Core 2024.4.3 Supervisor 2024.04.0 Operating System 12.2 Frontend 20240404.2

Logs of the issue (if applicable)

see above

Tockra commented 2 months ago

After changing server to server: mqtt://core-mosquitto my logs shows:

19:32:42] INFO: Preparing to start...
[19:32:42] INFO: Socat not enabled
[19:32:43] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info  2024-04-16 19:32:44: Logging to console and directory: '/config/zigbee2mqtt/log/2024-04-16.19-32-44' filename: log.txt
Zigbee2MQTT:info  2024-04-16 19:32:44: Starting Zigbee2MQTT version 1.36.1 (commit #unknown)
Zigbee2MQTT:info  2024-04-16 19:32:44: Starting zigbee-herdsman (0.40.3)
Zigbee2MQTT:info  2024-04-16 19:32:45: zigbee-herdsman started (resumed)
Zigbee2MQTT:info  2024-04-16 19:32:45: Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20210708,"transportrev":2},"type":"zStack3x0"}'
Zigbee2MQTT:info  2024-04-16 19:32:45: Currently 0 devices are joined:
Zigbee2MQTT:info  2024-04-16 19:32:45: Zigbee: disabling joining new devices.
Zigbee2MQTT:info  2024-04-16 19:32:45: Connecting to MQTT server at mqtt://core-mosquitto
Zigbee2MQTT:error 2024-04-16 19:32:45: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:45: MQTT failed to connect, exiting...
Zigbee2MQTT:info  2024-04-16 19:32:45: Stopping zigbee-herdsman...
Zigbee2MQTT:error 2024-04-16 19:32:46: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:47: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:48: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:49: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:50: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:51: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:52: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2024-04-16 19:32:53: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:info  2024-04-16 19:32:53: Stopped zigbee-herdsman
Tockra commented 2 months ago

After I did everything EXACTLY like in this video, it worked: https://www.youtube.com/watch?v=hGv8Jm574LE&t

I've no idea where the problem was. Maybe you need to add the mqtt json property in the textfield again (it looked wrong, but it worked). Maybe some restarts of the system was necessary to allow mosquitto to receive the account information. I don't know ... I'm not so brave to kill my configuration to find the reason for my issue ...