Sonoff Zigbee USB setup question- zigbee2mqtt

How do I configure my add-on to use an external MQTT broker?

I was using Mosquito on a Raspberry long before getting started with Home Assistant, so I’ve just kept using it. However, when configuring the zigbee2mqtt add on, I get an error in the logs:

Refusing to start because configuration is not valid, found the following errors:
-  must have required property 'mqtt'

Here’s the configuration I last tried:

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://192.168.1.124
serial:
  port: /dev/ttyUSB0

Can anyone tell me how to use an external MQTT broker with this add-on?

I not positive this will fix it for you but, your mqtt server line is missing a port number.
Like.
server: mqtt://192.168.1.124:xxxx

Yes the port is not assumed:

https://www.zigbee2mqtt.io/guide/configuration/mqtt.html

Progress.
I removed mqtt: and serial:

I realized that there were separate areas for those, and guessed that this is where the entries go:

Now, I get past the

-  must have required property 'mqtt'

Now, how do I get past the 502 Bad Gateway?

That’s from the z2m log?

Could you post the z2m log from the time you first start up z2m, too help.
Also, are you using ZHA as well?
If yes then both can not coexist in HA. choose one too control the zigbee netwok.

No, from the browser when opening the UI

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/socat.sh
[23:29:01] INFO: Socat not enabled, marking service as down
cont-init: info: /etc/cont-init.d/socat.sh exited 0
cont-init: info: running /etc/cont-init.d/zigbee2mqtt.sh
cont-init: info: /etc/cont-init.d/zigbee2mqtt.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 socat (no readiness notification)
services-up: info: copying legacy longrun zigbee2mqtt (no readiness notification)
[23:29:01] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start
> node index.js
Zigbee2MQTT:info  2022-06-28 23:29:02: Logging to console and directory: '/config/zigbee2mqtt/log/2022-06-28.23-29-02' filename: log.txt
Zigbee2MQTT:info  2022-06-28 23:29:02: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info  2022-06-28 23:29:02: Starting zigbee-herdsman (0.14.34)

After a few seconds the following is also logged:
============================================

Zigbee2MQTT:error 2022-06-28 23:29:22: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-06-28 23:29:23: Failed to start zigbee
Zigbee2MQTT:error 2022-06-28 23:29:23: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-06-28 23:29:23: Exiting...
Zigbee2MQTT:error 2022-06-28 23:29:23: 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)
[23:29:23] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start
> node index.js
Zigbee2MQTT:info  2022-06-28 23:29:24: Logging to console and directory: '/config/zigbee2mqtt/log/2022-06-28.23-29-24' filename: log.txt
Zigbee2MQTT:info  2022-06-28 23:29:24: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info  2022-06-28 23:29:24: Starting zigbee-herdsman (0.14.34)
Zigbee2MQTT:error 2022-06-28 23:29:44: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-06-28 23:29:44: Failed to start zigbee
Zigbee2MQTT:error 2022-06-28 23:29:44: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-06-28 23:29:44: Exiting...
Zigbee2MQTT:error 2022-06-28 23:29:44: Error: SRSP - SYS - getExtAddr after 6000ms
    at Timeout._onTimeout (/app/node_modules/zigbee-herdsman/src/utils/waitress.ts:64:35)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)
[23:29:44] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start
> node index.js
Zigbee2MQTT:info  2022-06-28 23:29:45: Logging to console and directory: '/config/zigbee2mqtt/log/2022-06-28.23-29-45' filename: log.txt
Zigbee2MQTT:info  2022-06-28 23:29:45: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info  2022-06-28 23:29:45: Starting zigbee-herdsman (0.14.34)

It’s not finding your dongle. Check the port is correct and that you have the dongle plugged in using a USB extension cable - away from the server.

It’s not connecting to your adapter. You well need to find the adapter and change this setting.

Usually it’s an ttyACM0 or some form of a ttyACM(0-2)

I appreciate your assistance.

The dongle is at least 2-3 ft from any server, AP or Z-wave device.

Here is my hardware:

ttyUSB0
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_584b60cc2e86ec11935e641719c2d21c-if00-port0
Subsystem:
tty
Device path:
/dev/ttyUSB0
ID:
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_584b60cc2e86ec11935e641719c2d21c-if00-port0
Attributes:
DEVLINKS: >-
  /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_584b60cc2e86ec11935e641719c2d21c-if00-port0
  /dev/serial/by-path/pci-0000:00:14.0-usb-0:2:1.0-port0
DEVNAME: /dev/ttyUSB0
DEVPATH: /devices/pci0000:00/0000:00:14.0/usb1/1-2/1-2:1.0/ttyUSB0/tty/ttyUSB0
ID_BUS: usb
ID_MODEL: Sonoff_Zigbee_3.0_USB_Dongle_Plus
ID_MODEL_ENC: Sonoff\x20Zigbee\x203.0\x20USB\x20Dongle\x20Plus
ID_MODEL_ID: ea60
ID_PATH: pci-0000:00:14.0-usb-0:2:1.0
ID_PATH_TAG: pci-0000_00_14_0-usb-0_2_1_0
ID_REVISION: '0100'
ID_SERIAL: ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_584b60cc2e86ec11935e641719c2d21c
ID_SERIAL_SHORT: 584b60cc2e86ec11935e641719c2d21c
ID_TYPE: generic
ID_USB_DRIVER: cp210x
ID_USB_INTERFACES: ':ff0000:'
ID_USB_INTERFACE_NUM: '00'
ID_VENDOR: ITead
ID_VENDOR_ENC: ITead
ID_VENDOR_ID: 10c4
MAJOR: '188'
MINOR: '0'
SUBSYSTEM: tty
TAGS: ':systemd:'
USEC_INITIALIZED: '1126248220536'

I ran a test to verify I have write access to the port:

[core-ssh ~]$ test -w /dev/ttyUSB0 && echo success || echo failure
success

Log file again:

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/socat.sh
[23:55:38] INFO: Socat not enabled, marking service as down
cont-init: info: /etc/cont-init.d/socat.sh exited 0
cont-init: info: running /etc/cont-init.d/zigbee2mqtt.sh
cont-init: info: /etc/cont-init.d/zigbee2mqtt.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 socat (no readiness notification)
services-up: info: copying legacy longrun zigbee2mqtt (no readiness notification)
[23:55:39] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start
> node index.js
Zigbee2MQTT:info  2022-06-28 23:55:40: Logging to console and directory: '/config/zigbee2mqtt/log/2022-06-28.23-55-40' filename: log.txt
Zigbee2MQTT:info  2022-06-28 23:55:40: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info  2022-06-28 23:55:40: Starting zigbee-herdsman (0.14.34)
Zigbee2MQTT:error 2022-06-28 23:56:00: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-06-28 23:56:00: Failed to start zigbee
Zigbee2MQTT:error 2022-06-28 23:56:00: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-06-28 23:56:00: Exiting...
Zigbee2MQTT:error 2022-06-28 23:56:00: 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)
[23:56:01] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start
> node index.js
Zigbee2MQTT:info  2022-06-28 23:56:02: Logging to console and directory: '/config/zigbee2mqtt/log/2022-06-28.23-56-02' filename: log.txt
Zigbee2MQTT:info  2022-06-28 23:56:02: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info  2022-06-28 23:56:02: Starting zigbee-herdsman (0.14.34)

This caught my eye:

Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)

This is from the docs:

If Zigbee2MQTT fails to start with a Texas Instruments LAUNCHXL-CC1352P-2/CC26X2R1 with Error: SRSP - SYS - version after 6000ms, you most probably have connected your device to a system that requires pressing the reset button (the one next to the USB connector) momentarily/shortly after connecting the USB cable. This issue has primarily been observed on x86 architectures only ( e.g., Intel NUC, HPE Microserver, i7 laptop), see also #2162. The procedure has to be repeated every time the adapter is re-connected and it's not clear yet, whether this can be fixed at all. It does not seem to occur on ARM based boards (Raspberry Pi, ODROID XU4).

The chip is a CC2652 and I am running HASP on a NUC. I did try pressing the reset button, but no difference.

Any ideas?

I do have a ConBee that I bought last year, should I abandon the Sonoff dongle and use that?

This is right out of the box. Should I try to flash the Sonoff?

Absolutely!
That’s my goto second step when my adapter fails to connect.

Sonoff dongle works fine for me, running the latest firmware.

Yours looks ok too. There are plenty of forum topics for “bad gateway” but no single solution by the look. The only time I have had it was after a reboot where I had left an ESP plugged into another port and the port number changed. I have got around that issue by using /dev/serial/by-id/... for the port rather than /dev/ttyUSB0, but that’s not your issue.

Dare I say uninstall reinstall :). Seems to have worked for some.

Anything else configured to use ‘ttyUSB0’ ?

No. The only other USB device I have is my Z-Wave dongle on /dev/ttyACM0

Curiouser and Curiouser.

I did nothing for an hour and wanted to look at the logs again, and now it looks like Zigbee started. Even more curious, the UI was now live. (Meaning Zigbee started?)

So, I tried to pair a Zigbee light (Ikea). And I got these errors. (Sorry for the screen grab)

zig2

I guess this is progress?

I only have success pairing things if they are within a metre or less of the controller. For globes and plugs I use an extension cord and place them about 25cm away from the controller.

I do have 4 station meshed wifi and a lot of devices - so I figure the 2.4GHz spectrum is a bit busy?

I have no issues once paired.

Kris - I just want to point out that mine uses ttyUSB0 also, just like Steve. So this is worth a check, but not necessarily the problem.
image

And, Steve and Kris, I would agree to Daryl above, and use /dev/serial/by-id/... instead, in your z2m configuration.

But then, well, looks like Steve has got his z2m going. So at least the device path to the dongle is not the problem (any more).

I tried:

port: >-
  /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_584b60cc2e86ec11935e641719c2d21c-if00-port0

No difference.

The log files still have:

Zigbee2MQTT:error 2022-06-29 11:24:00: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)

Which the docs indicate is endemic to X86 architecture.

I’ll try pressing the reset button again.

UPDATE:
Pushed the reset button after plugging in the dongle. No difference.

What is the switch on the dongle for?

Are you running with the latest HA OS?

Having you tried rebooting?

Did you read Zigbee2MQTT fails to start | Zigbee2MQTT? Lots of good suggestions there.

Yes, latest HAOS
Rebooting- No I hadn’t tried, but on your suggestion I rebooted. No difference.
I have been looking at suggestions from the link you provided. Which is why I keep coming back to this:
Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
which the tips in the link provided say is endemic to X86.

I also updated the firmware on the dongle.

The Sonoff dongle is new, and I also have a Conbee dongle plus a naked dongle that has a CC2531 chip, but I don’t recall where it came from. I kind of doubt that changing dongles would make any difference.

I am contemplating deleting Zigbee2MQTT and trying ZHA. Thoughts?

Here’s an idea. My HA is on an Intel NUC which the Zigbee2MQTT notes say may be a problem (X86).
I am running Mosquitto on a Raspberry Pi3 as my MQTT broker. (I was using NodeRed and MQTT long before I dipped my toes into Home Assistant, so I just kept using the broker on the Pi). What if I were to run another instance of HA on the Pi3 just to host my broker and the Zigbee dongle? My HA on the Nuc doesn’t care where the MQTT messages come from as long as they are on my local net.

Do you see any issues with that combination?