Zigbee2Mqtt gives me 502: Bad Gateway

Not on HA OS. Unless you have another pi lying around.

Replace

mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://localhost:1883

with

mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://core-mosquitto:1883 

and restart Zigbee2MQTT

See :

1 Like

I’ve already tried with that, exactly same result. :frowning:

Sorry for late reply, couldn’t reply because of new account or something

I had the same issue. Uninstalled the addon and reinstalled.
I am guessing you have a conbee ii.
If so add one line - adapter as per below.

mqtt:
base_topic: zigbee2mqtt
serial:
port: /dev/ttyACM0
adapter: deconz
advanced:
log_level: warn

No other changes. Mine worked after this.

1 Like

I don’t have conbee, I use CC2531 :frowning:

I’m using the same. Texas Instruments CC2531, getting the exact same issue.

Did you ever find a solution? This seems like an absolutely god-awful implementation. Documentation seems really spotty and outdated, and the errors seem to not really be remotely related to pointing to where the problems with the setup actually are.

There is a reason I run both mosquitto and Zigbee2mqtt on bare metal, and not as HA add-on. Never have any problems with this setup.

What hardware are you running zigbee2mqtt on?

An old Pi 1.

Having the same issue on several config.
All old addons is working fine with webUI. New addons (Double-take and zigbee2mqtt) fails with 502 bad gateway if Iopen from web interface and gives the connection refused if I open by ip:port.
This happens both on my supported supervised install oa regular computer and on hy hassos install on rpi3b

(In my case all other addons installed in last october version and now both instances updated to latest november.

Believe then this might be a “bigger problem”.

Hi guys! I had the same issue with 502: bad gateway.
I add first:
frontend: port: 8099 host: 0.0.0.0

and than I add one line with:

zigbee_herdsman_debug: true

I don’t know why but it helps, maybe it will help You also.

Cheers!

1 Like

Hello everyone, I searched all afternoon for the same problem!

My first problem was that the Conbee2 key was not recognized with the default setting ( port: /dev/ttyACM0), I found the solution here: Zigbee2MQTT - IOTstack / You must refer to /dev/serial/by-id/xxx

serial:
port: >-
/dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2438162-if00
adapter: deconz

and @Kris-O’s solution did the rest

front-end:
port: 8099

if it can help others :wink:

1 Like

In my case I had the ZHA add on running. I guess two into one doesn’t go.

2 Likes

I’m having the same problem. “502 Bad Gateway”.
Here is my zigbee2mqtt 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
  server: mqtt://core-mosquitto:1883
  user: mqtt
  password: password
serial:
  port: >-
    /dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00123C041XF6A431-if00
frontend:
  port: 8099
zigbee_herdsman_debug: true

I have tried different suggestions listed in this thread to no avail.

In the main hass log, I see this:


22-04-13 15:10:11 INFO (SyncWorker_4) [supervisor.docker.addon] Starting Docker add-on zigbee2mqtt/zigbee2mqtt-amd64 with version 1.25.0-1
22-04-13 15:10:11 WARNING (MainThread) [supervisor.addons.options] Unknown option 'base_topic' for Zigbee2mqtt (45df7312_zigbee2mqtt)
22-04-13 15:10:11 WARNING (MainThread) [supervisor.addons.options] Option 'frontend' does not exist in the schema for Zigbee2mqtt (45df7312_zigbee2mqtt)
22-04-13 15:10:12 WARNING (MainThread) [supervisor.addons.options] Unknown option 'base_topic' for Zigbee2mqtt (45df7312_zigbee2mqtt)
22-04-13 15:10:12 WARNING (MainThread) [supervisor.addons.options] Option 'frontend' does not exist in the schema for Zigbee2mqtt (45df7312_zigbee2mqtt)

In the zigbee2mqtt log, it keeps looping a bunch of debug data every 10 seconds. This looks like the important bit:


2022-04-13T22:13:52.755Z zigbee-herdsman:adapter:zStack:znp:log Port closed
Zigbee2MQTT:info  2022-04-13 15:13:52: Stopped zigbee-herdsman
[15:13:52] INFO: Zigbee Herdsman debug logging enabled
[15:13:53] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start
> node index.js

I figured it out. It had nothing to do with being able to open a port for the frontend. The problem was that my mqtt username and password was incorrect. I wish the log (or the front end) would have told me that…

I have a nortek ZHA and when I install zigbee2mtqq, I get the same error

Error while starting zigbee-herdsman
Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms

and my zigbee devices stop working. Any work around? can I use both since I have all my zigbee devices already setup on the ZHA?

I just need to try and update some firware on my linkind movement sensors.

No. You can only use one Zigbee stack (ZHA or Zigbee2Mqtt) using the same stick at the same time.

This one is unsupported, unless you upgrade the Zigbee firmware.

1 Like

In that thread we solved the issue by differents ways. Check the last messages. And good luck.

Home assistant was working perfectly. After a power down and several reboot I had always => 502:bad Gateway.

I restarted the addon MQTT and then restarted the addon zigbee2mqtt and it works again.

Now I like to know if that is working in all the cases?

I have this exact same issue. I cannot access the Web UI

Logs for mqqt & zigbee2mqqt all look fine, both containers are running

Zigbee2MQTT:info 2022-08-22 12:42:37: Logging to console and directory: ‘/app/data/log/2022-08-22.12-42-37’ filename: log.txt
Zigbee2MQTT:info 2022-08-22 12:42:37: Starting Zigbee2MQTT version 1.27.0 (commit #a9b8808)
Zigbee2MQTT:info 2022-08-22 12:42:37: Starting zigbee-herdsman (0.14.46)
Zigbee2MQTT:info 2022-08-22 12:42:37: zigbee-herdsman started (resumed)
Zigbee2MQTT:info 2022-08-22 12:42:37: Coordinator firmware version: ‘{“meta”:{“maintrel”:3,“majorrel”:2,“minorrel”:6,“product”:0,“revision”:20211116,“transportrev”:2},“type”:“zStack12”}’
Zigbee2MQTT:info 2022-08-22 12:42:37: Currently 0 devices are joined:
Zigbee2MQTT:warn 2022-08-22 12:42:37: permit_join set to true in configuration.yaml.
Zigbee2MQTT:warn 2022-08-22 12:42:37: Allowing new devices to join.
Zigbee2MQTT:warn 2022-08-22 12:42:37: Set permit_join to false once you joined all devices.
Zigbee2MQTT:info 2022-08-22 12:42:37: Zigbee: allowing new devices to join.
Zigbee2MQTT:info 2022-08-22 12:42:38: Connecting to MQTT server at mqtt://192.168.1.22:1883
Zigbee2MQTT:info 2022-08-22 12:42:38: Connected to MQTT server
Zigbee2MQTT:info 2022-08-22 12:42:38: MQTT publish: topic ‘zigbee2mqtt/bridge/state’, payload ‘online’
Zigbee2MQTT:info 2022-08-22 12:42:38: MQTT publish: topic ‘zigbee2mqtt/bridge/config’, payload ‘{“commit”:“a9b8808”,“coordinator”:{“meta”:{“maintrel”:3,“majorrel”:2,“minorrel”:6,“product”:0,“revision”:20211116,“transportrev”:2},“type”:“zStack12”},“log_level”:“info”,“network”:{“channel”:11,“extendedPanID”:“0x00124b001cd4e548”,“panID”:6754},“permit_join”:true,“version”:“1.27.0”}’
Zigbee2MQTT:info 2022-08-22 12:42:38: MQTT publish: topic ‘zigbee2mqtt/bridge/state’, payload ‘online’