Zigbee2MQTT Edge : 502: Bad Gateway

Hello guy’s

I have been strugling for weeks now trying to understand why i get a 502 bad gateway when trying to use Zigbee2MQTT and also Node.

Today i went ssh and got more infos.
I made progress but i still cant open the web gui : still 502 error.

The log seem to tell me my problem, i am not sure how to solve.

Here is the log:

YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key (4:1)
 1 | homeassistant: true
 2 | pan_id
 3 | network_key
 4 | 
-----^
    at generateError (/app/node_modules/js-yaml/lib/loader.js:183:10)
    at throwError (/app/node_modules/js-yaml/lib/loader.js:187:9)
    at readBlockMapping (/app/node_modules/js-yaml/lib/loader.js:1145:9)
    at composeNode (/app/node_modules/js-yaml/lib/loader.js:1441:12)
    at readDocument (/app/node_modules/js-yaml/lib/loader.js:1625:3)
    at loadDocuments (/app/node_modules/js-yaml/lib/loader.js:1688:5)
    at Object.load (/app/node_modules/js-yaml/lib/loader.js:1714:19)
    at Object.read (/app/lib/util/yaml.ts:7:21)
    at read (/app/lib/util/settings.ts:311:20)
    at getInternalSettings (/app/lib/util/settings.ts:419:21)
[21:43:03] INFO: Handing over control to Zigbee2MQTT Core ...

By the way, i am running a new install, nothing install but Zigbee2MQTT on a NUC with a sonoff dongle.

Everything work well, except the damn 502 error.

Any help ?

Please show your Z2M version and configuration. Without it it is hard to narrow down the source of the error.

1 Like

I woke up to this in the morning.

Even more confuse. How can a save configuration change in a reboot ?

So here is my usual 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: 
  user: mqtt-user
  password: @**************
serial: f212aa295386ec11b553e937********

now, every time i save the config, it will revert to nothing as it reboot.
Seem my yaml no longuer saved itself even if i click save

Think your Z2M configuration is the problem. Where do you copy this from? My Z2M configuration.yaml file is very different to look at.

Further, you need a MQTT broker. You do not mention having installed it? Just chose the default add-on MQTT.

For inspiration have a look. remember that some of the settings are not configured through the yaml file, however done directly in the Z2M add-on. This have changed some month ago.

external_converters: []
devices:
  - devices.yaml
groups:
  - groups.yaml
homeassistant:
  legacy_entity_attributes: false
  legacy_triggers: true
permit_join: false
mqtt:
  base_topic: zigbee2mqtt
  user: MQTTUser
  password: XXXXXXX
  server: mqtt://core-mosquitto:1883
serial:
  port: >-
    /dev/serial/by-id/usb-ITead_Sonoff_Zigbee_3.0_USB_Dongle_Plus_d617560171d9eb11bf30158e6fe9f4d9-if00-port0
advanced:
  log_level: warn
  pan_id: 1
  channel: 13
  network_key:
    - 20
  x
  x 
  x
  x
  availability_blocklist: []
  availability_passlist: []
  last_seen: ISO_8601_local
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
  port: 8099
experimental: {}
availability: false