Zigbee2mqtt 502 bad gateway cc2531 error

Hello, can someone help me, I have the following problem.
zigbee2mqtt instaliert and all configurations made but does not work, I get the following error message. ‘502 Bad Gateway’
I’ve been trying for three days, I can’t get it going.
zigbee2mqtt setting:

data_path: /config/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  user: mqtt
  password: *****
  server: 'mqtt://core-mosquitto:1883'
serial:
  port: >-
    /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0019387099-if00
advanced:
  log_level: warn
  pan_id: 6754
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blocklist: []
  availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental: {}
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

zigbee2mqtt log file:

Zigbee2MQTT:error 2021-05-11 22:45:58: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2021-05-11 22:45:58: Failed to start zigbee
Zigbee2MQTT:error 2021-05-11 22:45:58: Check https://www.zigbee2mqtt.io/information/FAQ.html#help-zigbee2mqtt-fails-to-start for possible solutions
Zigbee2MQTT:error 2021-05-11 22:45:58: Exiting...
Zigbee2MQTT:error 2021-05-11 22:45:58: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.<anonymous> (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:94:31)
    at Generator.throw (<anonymous>)
    at rejected (/app/node_modules/zigbee-herdsman/dist/adapter/z-stack/adapter/zStackAdapter.js:25:65)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-05-11T20_45_58_819Z-debug.log
[22:45:59] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start /app
> node index.js

Supervisor log file:

21-05-11 20:37:00 ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.3:8099 ssl:default [Connect call failed ('172.30.33.3', 8099)]
21-05-11 20:37:04 ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.3:8099 ssl:default [Connect call failed ('172.30.33.3', 8099)]
21-05-11 20:38:05 ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.3:8099 ssl:default [Connect call failed ('172.30.33.3', 8099)]
21-05-11 20:39:07 INFO (SyncWorker_2) [supervisor.docker.interface] Stopping addon_486e6e9b_zigbee2mqtt application
21-05-11 20:39:11 INFO (SyncWorker_2) [supervisor.docker.interface] Cleaning addon_486e6e9b_zigbee2mqtt application
21-05-11 20:39:13 INFO (SyncWorker_0) [supervisor.docker.addon] Starting Docker add-on zigbee2mqtt/zigbee2mqtt-amd64 with version 1.18.3-1
21-05-11 20:42:58 ERROR (MainThread) [supervisor.api.ingress] Ingress error: Cannot connect to host 172.30.33.3:8099 ssl:default [Connect call failed ('172.30.33.3', 8099)]

Mosquitto broker setting

logins:
  - username: mqtt
    password: *****
anonymous: false
customize:
  active: false
  folder: mosquitto
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

Mosquitto broker log file:

[22:32:52] INFO: Setup mosquitto configuration
[22:32:52] WARNING: SSL not enabled - No valid certs found!
[22:32:52] INFO: Found local users inside config
[22:32:53] INFO: Initialize Home Assistant Add-on services
[22:32:53] INFO: Initialize Home Assistant discovery
[22:32:53] INFO: Start Mosquitto daemon
1620765173: mosquitto version 1.6.3 starting
1620765173: Config loaded from /etc/mosquitto.conf.
1620765173: Loading plugin: /usr/share/mosquitto/auth-plug.so
1620765173: |-- *** auth-plug: startup
1620765173:  ├── Username/password checking enabled.
1620765173:  ├── TLS-PSK checking enabled.
1620765173:  └── Extended authentication not enabled.
1620765173: Opening ipv4 listen socket on port 1883.
1620765173: Opening ipv6 listen socket on port 1883.
1620765173: Opening websockets listen socket on port 1884.
1620765173: Warning: Mosquitto should not be run as root/administrator.
1620765204: New connection from 172.30.32.1 on port 1883.
[22:33:26] INFO: [INFO] found mqtt on local database
1620765206: New client connected from 172.30.32.1 as 3n2W185B03kjO7yT9ne9z9 (p2, c1, k60, u'mqtt').
1620765231: New connection from 192.168.178.22 on port 1883.
1620765231: New client connected from 192.168.178.22 as DVES_008112 (p2, c1, k30, u'mqtt').

System:

Add this to your Z2M config:

experimental:
  new_api: true
1 Like

Unfortunately does not work.

1-05-11 22:53:48 INFO (SyncWorker_1) [supervisor.docker.interface] Stopping addon_core_mosquitto application
21-05-11 22:53:49 INFO (SyncWorker_1) [supervisor.docker.interface] Cleaning addon_core_mosquitto application
21-05-11 22:53:52 INFO (SyncWorker_0) [supervisor.docker.addon] Starting Docker add-on homeassistant/amd64-addon-mosquitto with version 5.1.1
21-05-11 22:53:56 ERROR (MainThread) [supervisor.services.modules.mqtt] There is already a MQTT service in use from core_mosquitto
21-05-11 22:54:41 WARNING (MainThread) [supervisor.addons.options] Unknown option 'new_api' for Zigbee2mqtt (486e6e9b_zigbee2mqtt)

Remove the cc2531 and insert again

1 Like

Unfortunately without success

Not clear why you have this error:

21-05-11 22:54:41 WARNING (MainThread) [supervisor.addons.options] Unknown option 'new_api' for Zigbee2mqtt (486e6e9b_zigbee2mqtt)

Can you please share the whole config again?
Below for example is mine:

data_path: /share/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.1.55'
  user: my_user
  password: my_password
serial:
  port: >-
    /dev/serial/by-id/usb-Silicon_Labs_slae.sh_cc2652rb_stick_-_slaesh_s_iot_stuff_00_12_4B_00_21_A8_E9_83-if00-port0
advanced:
  log_level: info
  pan_id: 6757
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blocklist: []
  availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental:
  new_api: true
socat:
  enabled: false
  master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
  slave: 'tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5'
  restartdelay: 1
  initialdelay: 1
  options: '-d -d'
  log: false
data_path: /config/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://192.168.178.39:1883'
  user: mqtt
  password: *******
serial:
  port: >-
    /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0019387099-if00
advanced:
  log_level: warn
  pan_id: 6754
  channel: 11
  network_key:
    - 1
    - 3
    - 5
    - 7
    - 9
    - 11
    - 13
    - 15
    - 0
    - 2
    - 4
    - 6
    - 8
    - 10
    - 12
    - 13
  availability_blocklist: []
  availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental: {}
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

Although this doesn’t solve your problem:

  new_api: true

seems not needed anymore since z2m v1.18.2.

Leave the “experimental”-part in your config empty like this

experimental: {}

Instead of:

server: 'mqtt://core-mosquitto:1883'

Try the following:

server: 'mqtt://172.30.33.3:1883'

and restart the Z2M-addon

I don’t understand that still doesn’t work

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-05-12T02_32_31_319Z-debug.log
[04:32:31] INFO: Zigbee Herdsman debug logging enabled
[04:32:32] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start /app
> node index.js
2021-05-12T02:32:40.101Z zigbee-herdsman:adapter Failed to validate path: 'Error: spawn udevadm ENOENT'
2021-05-12T02:32:40.111Z zigbee-herdsman:controller:log Starting with options '{"network":{"networkKeyDistribute":false,"networkKey":[1,3,5,7,9,11,13,15,0,2,4,6,8,10,12,13],"panID":6754,"extendedPanID":[221,221,221,221,221,221,221,221],"channelList":[11]},"serialPort":{"path":"/dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0019387099-if00"},"databasePath":"/config/zigbee2mqtt/database.db","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","backupPath":"/config/zigbee2mqtt/coordinator_backup.json","adapter":{"concurrent":null,"delay":null}}'
2021-05-12T02:32:40.115Z zigbee-herdsman:adapter:zStack:znp:log Opening SerialPort with /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0019387099-if00 and {"baudRate":115200,"rtscts":false,"autoOpen":false}
2021-05-12T02:32:40.132Z zigbee-herdsman:adapter:zStack:znp:log Serialport opened
2021-05-12T02:32:40.617Z zigbee-herdsman:adapter:zStack:znp:log Writing skip bootloader payload
2021-05-12T02:32:40.619Z zigbee-herdsman:adapter:zStack:unpi:writer --> buffer [239]
2021-05-12T02:32:41.636Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2021-05-12T02:32:41.643Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
2021-05-12T02:32:47.649Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2021-05-12T02:32:47.652Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
2021-05-12T02:32:53.661Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2021-05-12T02:32:53.663Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
Zigbee2MQTT:error 2021-05-12 04:32:59: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2021-05-12 04:32:59: Failed to start zigbee
Zigbee2MQTT:error 2021-05-12 04:32:59: Check https://www.zigbee2mqtt.io/information/FAQ.html#help-zigbee2mqtt-fails-to-start for possible solutions
Zigbee2MQTT:error 2021-05-12 04:32:59: Exiting...
Zigbee2MQTT:error 2021-05-12 04:32:59: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)

What is

sudo ip r

saying?

And please show the last ~20 lines of:

/root/.npm/_logs/2021-05-12T02_32_31_319Z-debug.log
default via 192.168.178.1 dev enp1s0 
default via 192.168.178.1 dev enp1s0 proto static metric 100 
169.254.0.0/16 dev enp1s0 scope link metric 1000 
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 
172.30.32.0/23 dev hassio proto kernel scope link src 172.30.32.1 
192.168.178.0/24 dev enp1s0 proto kernel scope link src 192.168.178.39 metric 100

Well, then:
server: 'mqtt://192.168.178.39:1883'
is correct.

1 Like

server: ‘mqtt://192.168.178.39:1883’`
is correct.