Zigbee2MQTT/Mosquitto 502 bad gateway

Hi All

I’m running into a bit of an issue and wondering if you can help.

Details of what I’m running:
PC: NUC 11th gen running HAOS
Dongle: Sonoff Zigbee 3.0 Dongle
Router: Unifi Dream Machine Pro
Switch: Unifi

I’ve listed the Unifi products as I have a vague memory from a long time ago (when learning about HASS) that there can be issues with port conflicts with MQTT?

I’ve been following these guides, which are slightly out of date:

I’ve also gone through some older forum posts without much success such as:

As the settings have changed, I’m not sure where the issue lies but I’ll provide the info that I can and confirm the steps.

  1. Flashed Sonoff stick using disassemble method, worked fine after updating the driver etc.
  2. Installed Mosquitto
  3. Installed Zigbee2MQTT
  4. Configured both based on the details in both videos, moreso using Smart Home Junkie as his was less outdated.

I’ll list slightly edited YAML for both, I had edited them slightly due to some forum threads and trying to get it working (with changing some ports etc) but that hasn’t worked.

Zigbee2MQTT YAML:

data_path: /config/zigbee2mqtt
socat:
  enabled: false
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: '-d -d'
  log: false
mqtt:
  server: mqtt://core-mosquitto
  user: *user*
  password: *password*
serial:
  port: /dev/ttyUSB0

In Zigbee2MQTT I also have the following ports:
Socat tcp-listen port: 8099

Mosquitto broker YAML:

logins: []
require_certificate: false
certfile: fullchain.pem
keyfile: privkey.pem
customize:
  active: false
  folder: mosquitto

In Mosquitto broker I also have the following ports:
Normal MQTT: 1883
MQTT ovewr WebSocket: 1884
Normal MQTT with SSL: 8883
MQTT over Websocket with SSL: 8884

I’m not sure if the issue lies with the ports or that in the Mosquitto broker there is no login?

My YAML for both was exactly the same as Smart Home Junkie’s, aside from the “adapter: deconz” at the bottom.

Hopefully this is the information someone would need to help but I’ll of course provide more if necessary!

Many thanks in advance for any help you can provide!

I’ve since tried following this guide but still running into errors: Sonoff Zigbee 3 0 USB Dongle Plus with Zigbee2MQTT on Home Assistant - YouTube

I realised whilst watching it however that I’m getting errors in Zigbee2MQTT, listing them below.

[01:01:42] INFO: Handing over control to Zigbee2MQTT Core ...
> [email protected] start
> node index.js
Zigbee2MQTT:info  2022-07-22 01:01:42: Logging to console and directory: '/config/zigbee2mqtt/log/2022-07-22.01-01-42' filename: log.txt
Zigbee2MQTT:info  2022-07-22 01:01:42: Starting Zigbee2MQTT version 1.26.0 (commit #unknown)
Zigbee2MQTT:info  2022-07-22 01:01:42: Starting zigbee-herdsman (0.14.40)
Zigbee2MQTT:error 2022-07-22 01:02:03: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-07-22 01:02:03: Failed to start zigbee
Zigbee2MQTT:error 2022-07-22 01:02:03: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-07-22 01:02:03: Exiting...
Zigbee2MQTT:error 2022-07-22 01:02:03: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:102:27)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:123:29)
    at Zigbee.start (/app/lib/zigbee.ts:58:27)
    at Controller.start (/app/lib/controller.ts:101:27)
    at start (/app/index.js:109:5)

I’ve tried entering both of the following as ports, both were found using the advice from the Youtube videos, in my HASS:
/dev/ttyUSB0
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_169c49eb0813ec11a25d20c7bd930c07-if00-port0

Googling the issue “Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)” I found this article:
https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html#error-resource-temporarily-unavailable-cannot-lock-port

It lists 4 common reasons.

  1. I am trying to follow the guide but as this is my first Linux system, I’m not finding it easy to follow. Using the Youtube videos, I have found the ports and listed them above so I guess it isn’t this?
  2. I’m not using these deices.
  3. The guides don’t mention this for Sonoff so I think this is fine?
  4. I can’t actually find a way to disable ZHA… There’s no info on this in the article, browsing other forum threads hasn’t shed light on this either.

I realised that I did 1 thing differently to the latest video which was that I already configured the zigbee dongle rather than ignore it however.

And its fixed, posting here to help others in case…

As I had used the previous videos which were outdated and used different methods, I had allowed HASS to configure the Sonoff dongle.

I deleted it from HASS, restarted HASS, it came up with the notification that it could be set up again, I followed the steps in the video to ignore it and now Zigbee2MQTT works!

2 Likes