Configuring Zigbee2MQTT as a noob

Hello everyone, I am new, I mean 2 days new and I am already starting to go bald. I have searched forums and YouTube tutorials. I have tried to make sense of documentation and i have banged my head on my keyboard whilst on Google. I am losing the will to live. I am trying to install Zigbee2MQTT and Mosquito MQTT as I have bought a bunch of IKEA sensors. I think I have got the second one down, but there is so much conflicting or outdated information out there that I am just going in circles here, as everytime I try to load the Zigbee2MQTT GUI I get an “502: Bad Gateway”error.
I have the Sonoff 3.0 dongle which I have flashed with custom firmware.
Any help would be appreciated, here is my config:

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:
  base_topic: zigbee2mqtt
  user: mqtt
  password: pass1234
serial:
  port: /dev/ttyUSB0

Are you using the zigbee2mqtt addon? It creates logs. Please post them.

1 Like

Thanks for responding so quickly. I am, the logs are:

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
[09:57:50] 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)
[09:57:52] INFO: Handing over control to Zigbee2mqtt Core …

[email protected] start
node index.js
Refusing to start because configuration is not valid, found the following errors:

  • mqtt must have required property ‘server’
    If you don’t know how to solve this, read Configuration | Zigbee2MQTT
    !!!
    [09:54:05] INFO: Handing over control to Zigbee2mqtt Core …

[email protected] start
node index.js
!!!
READ THIS CAREFULLY
Refusing to start because configuration is not valid, found the following errors:

  • mqtt must have required property ‘server’
    If you don’t know how to solve this, read Configuration | Zigbee2MQTT
    !!!
    [09:54:08] INFO: Handing over control to Zigbee2mqtt Core …

[email protected] start
node index.js
!!!
READ THIS CAREFULLY
Refusing to start because configuration is not valid, found the following errors:

  • mqtt must have required property ‘server’
    If you don’t know how to solve this, read (I had to remove the link to post)
    !!!
    [09:54:11] INFO: Handing over control to Zigbee2mqtt Core …

[email protected] start
node index.js
!!!
READ THIS CAREFULLY
Refusing to start because configuration is not valid, found the following errors:

  • mqtt must have required property ‘server’
    If you don’t know how to solve this, read (I had to remove the link to post)
    !!!
    [09:54:14] INFO: Handing over control to Zigbee2mqtt Core …

[email protected] start
node index.js
!!!
READ THIS CAREFULLY
Refusing to start because configuration is not valid, found the following errors:

  • mqtt must have required property ‘server’
    If you don’t know how to solve this, read (I had to remove the link to post)
    !!!
    [09:54:17] INFO: Handing over control to Zigbee2mqtt Core …

[email protected] start
node index.js
!!!
READ THIS CAREFULLY
Refusing to start because configuration is not valid, found the following errors:

  • mqtt must have required property ‘server’
    If you don’t know how to solve this, read (I had to remove the link to post)
    !!!
    [09:54:20] INFO: Handing over control to Zigbee2mqtt Core …

You have not got a mqtt server specified. It should be server: mqtt://core-mosquitto:1883 (assuming again that you are using the mosquitto addon),so this bit should look like

mqtt:
  base_topic: zigbee2mqtt
  user: mqtt
  password: pass1234
  server: mqtt://core-mosquitto:1883
2 Likes

Thanks again for the quick reply.

I have copied your code and I am still seeing the error on the UI. I am not sure if it makes a difference but my HA OS is on an Intel NUC in Proxmox.

My config:

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:
  base_topic: zigbee2mqtt
  user: mqtt
  password: Pass1234
  server: mqtt://core-mosquitto:1883
serial:
  port: /dev/ttyUSB0

My 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/socat.sh
[10:37:43] 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)
[10:37:44] INFO: Handing over control to Zigbee2mqtt Core …

[email protected] start
node index.js
Zigbee2MQTT:info 2022-06-03 10:37:48: Logging to console and directory: ‘/config/zigbee2mqtt/log/2022-06-03.10-37-48’ filename: log.txt
Zigbee2MQTT:info 2022-06-03 10:37:48: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info 2022-06-03 10:37:48: Starting zigbee-herdsman (0.14.34)
Zigbee2MQTT:error 2022-06-03 10:38:09: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-06-03 10:38:09: Failed to start zigbee
Zigbee2MQTT:error 2022-06-03 10:38:09: Check Zigbee2MQTT fails to start | Zigbee2MQTT for possible solutions
Zigbee2MQTT:error 2022-06-03 10:38:09: Exiting…
Zigbee2MQTT:error 2022-06-03 10:38:09: 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)
[10:38:10] INFO: Handing over control to Zigbee2mqtt Core …
[email protected] start
node index.js
Zigbee2MQTT:info 2022-06-03 10:38:14: Logging to console and directory: ‘/config/zigbee2mqtt/log/2022-06-03.10-38-14’ filename: log.txt
Zigbee2MQTT:info 2022-06-03 10:38:14: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info 2022-06-03 10:38:14: Starting zigbee-herdsman (0.14.34)
Zigbee2MQTT:error 2022-06-03 10:38:34: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-06-03 10:38:34: Failed to start zigbee
Zigbee2MQTT:error 2022-06-03 10:38:34: Check (link removed so I can post)for possible solutions
Zigbee2MQTT:error 2022-06-03 10:38:34: Exiting…
Zigbee2MQTT:error 2022-06-03 10:38:34: 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)
[10:38:35] INFO: Handing over control to Zigbee2mqtt Core …
[email protected] start
node index.js
Zigbee2MQTT:info 2022-06-03 10:38:39: Logging to console and directory: ‘/config/zigbee2mqtt/log/2022-06-03.10-38-39’ filename: log.txt
Zigbee2MQTT:info 2022-06-03 10:38:39: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info 2022-06-03 10:38:39: Starting zigbee-herdsman (0.14.34)
Zigbee2MQTT:error 2022-06-03 10:39:04: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-06-03 10:39:04: Failed to start zigbee
Zigbee2MQTT:error 2022-06-03 10:39:04: Check (link removed so I can post)for possible solutions
Zigbee2MQTT:error 2022-06-03 10:39:04: Exiting…
Zigbee2MQTT:error 2022-06-03 10:39:04: 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)
[10:39:05] INFO: Handing over control to Zigbee2mqtt Core …
[email protected] start
node index.js
Zigbee2MQTT:info 2022-06-03 10:39:09: Logging to console and directory: ‘/config/zigbee2mqtt/log/2022-06-03.10-39-09’ filename: log.txt
Zigbee2MQTT:info 2022-06-03 10:39:09: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info 2022-06-03 10:39:09: Starting zigbee-herdsman (0.14.34)
Zigbee2MQTT:error 2022-06-03 10:40:48: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-06-03 10:40:48: Failed to start zigbee
Zigbee2MQTT:error 2022-06-03 10:40:48: Check (link removed so I can post)for possible solutions
Zigbee2MQTT:error 2022-06-03 10:40:48: Exiting…
Zigbee2MQTT:error 2022-06-03 10:40:48: TypeError: Cannot read properties of undefined (reading ‘payload’)
at AdapterNvMemory.deleteItem (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/adapter-nv-memory.ts:141:39)
at ZnpAdapterManager.beginCommissioning (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/manager.ts:330:9)
at ZnpAdapterManager.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/manager.ts:92:17)
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)
[10:40:49] INFO: Handing over control to Zigbee2mqtt Core …
[email protected] start
node index.js
Zigbee2MQTT:info 2022-06-03 10:40:53: Logging to console and directory: ‘/config/zigbee2mqtt/log/2022-06-03.10-40-53’ filename: log.txt
Zigbee2MQTT:info 2022-06-03 10:40:53: Starting Zigbee2MQTT version 1.25.2 (commit #unknown)
Zigbee2MQTT:info 2022-06-03 10:40:53: Starting zigbee-herdsman (0.14.34)

I’m having the same situation and just cannot seem to move forward, though, I did inch forward some last night thanks to some help… but on the topic of conflicting information;

I have no idea what’s real any more with this thing… suggestions seem to change over night. I’ll be following this thread too, to see if you get resolved. Feel welcome to follow my thread as it may offer you an insight too.

The error is in relation to the adapter, you port is ttyusb0, are you sure it is right. Mine is

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

Karm, what is you error log?

Zigbee2MQTT:info 2022-06-03 10:21:17: Zigbee: allowing new devices to join.
Zigbee2MQTT:info 2022-06-03 10:21:17: Connecting to MQTT server at mqtt://192.168.0.61:1883
Zigbee2MQTT:error 2022-06-03 10:21:23: MQTT failed to connect: read ECONNRESET
Zigbee2MQTT:error 2022-06-03 10:21:23: Exiting…
Zigbee2MQTT:info 2022-06-03 10:21:23: Stopping zigbee-herdsman…

I tried your suggestion of making the mqtt_user an admin and leaving out the username/pass & server info so it can use the defaults - but it still dies at the same point each time.
As far as I’m aware - my broker is set up correctly.

I’ve found a recurring error in the logs for the broker… So, perhaps it isn’t quite as functional as I’d imagined. I’ve copied it in to my own thread but it is also included in my OP which I’ve linked to in my previous post on this thread.

I was following a guide to get that from the hardware discripton, so I am unsure if it is correct. let me copy the Hardware details for you:

ttyUSB0
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_ce9140dc7c3bec11a91a9c957a0af07f-if00-port0
Subsystem:
tty
Device path:
/dev/ttyUSB0
ID:
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_ce9140dc7c3bec11a91a9c957a0af07f-if00-port0
Attributes:
DEVLINKS: >-
/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_ce9140dc7c3bec11a91a9c957a0af07f-if00-port0
/dev/serial/by-path/pci-0000:01:1b.0-usb-0:3:1.0-port0
DEVNAME: /dev/ttyUSB0
DEVPATH: >-
/devices/pci0000:00/0000:00:1e.0/0000:01:1b.0/usb2/2-3/2-3: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:01:1b.0-usb-0:3:1.0
ID_PATH_TAG: pci-0000_01_1b_0-usb-0_3_1_0
ID_REVISION: ‘0100’
ID_SERIAL: ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_ce9140dc7c3bec11a91a9c957a0af07f
ID_SERIAL_SHORT: ce9140dc7c3bec11a91a9c957a0af07f
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: ‘3959492’

Yeah I am lost, I have tried playing with various settings and I am getting nowhere. Any help would be greatly appreciated.

Not sure if it is the same thing but I have literally just started setting up Zigbee2mqtt and was getting a 502 bad gateway.
I had forgotten to click configure in the mosquito broker add on. I clicked that, said ok/yes to the pop up and succefully got past the 502 when I went back to the interface for Z2M

No I did that yesterday and that did not work for me sadly. I would love to see what your configuration looks like though if you managed to get past that error.

I’ve had my broker configured since day 1… never worked.

1 Like

My port is looking like this:

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

I think it fits well with your

/dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_ce9140dc7c3bec11a91a9c957a0af07f-if00-port0

Have you tried to use this ad port?

Your MQTT setup, is it starting without any errors? My MQTT configuration looks like this

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

I was about to try this and saw there was a HA update so I updated from 2022.6 to 2022.6.1. I thought I would check the UI once before changing the setting and it worked. I have 0 explanation as to why but it did.

Thank you to everyone that tried to help, I know it must get frustrating trying to help us noobs.

for reference the working code is:

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:
  base_topic: zigbee2mqtt
  user: mqtt
  password: pass1234
  server: mqtt://core-mosquitto:1883
serial:
  port: /dev/ttyUSB0

Okay I spoke to soon, errors continue. When I click “Permit join all” I get error messages and the following in my log file:

Info 2022-06-03 19:21:21Zigbee: allowing new devices to join.
Error 2022-06-03 19:21:27Request 'zigbee2mqtt/bridge/request/permit_join' failed with error: 'SRSP - ZDO - mgmtPermitJoinReq after 6000ms'

Info 2022-06-03 19:21:27MQTT publish: topic 'zigbee2mqtt/bridge/response/permit_join', payload '{"data":{},"error":"SRSP - ZDO - mgmtPermitJoinReq after 6000ms","status":"error","transaction":"i6b6i-2"}'

Update: New errors after restart:

Info 2022-06-03 19:48:07Zigbee: allowing new devices to join.

Error 2022-06-03 19:48:07Request 'zigbee2mqtt/bridge/request/permit_join' failed with error: 'SREQ '--> AF - dataRequestExt - {"dstaddrmode":2,"dstaddr":"0x000000000000fffd","destendpoint":242,"dstpanid":0,"srcendpoint":242,"clusterid":33,"transid":2,"options":0,"radius":30,"len":6,"data":{"type":"Buffer","data":[25,3,2,11,254,0]}}' failed with status '(0x02: INVALID_PARAM)' (expected '(0x00: SUCCESS)')'

Info 2022-06-03 19:48:07MQTT publish: topic 'zigbee2mqtt/bridge/response/permit_join', payload '{"data":{},"error":"SREQ '--> AF - dataRequestExt - {\"dstaddrmode\":2,\"dstaddr\":\"0x000000000000fffd\",\"destendpoint\":242,\"dstpanid\":0,\"srcendpoint\":242,\"clusterid\":33,\"transid\":2,\"options\":0,\"radius\":30,\"len\":6,\"data\":{\"type\":\"Buffer\",\"data\":[25,3,2,11,254,0]}}' failed with status '(0x02: INVALID_PARAM)' (expected '(0x00: SUCCESS)')","status":"error","transaction":"n3dkr-1"}'

Update I tried to pair using the mobile app and it worked. Something is clearly not working properly but I’m clueless as to what. Also too tired to try and pair more than one device tonight.