Zigbee2MQTT - 502: Bad Gateway *SOLVED*

I also have the bad gateway and after installing Studio Code Server I cannot see the file state.json but I cannot get Zigbee2MQTT working, what could I try next?

I have no idea if this is the actual solution, but I had a lot of trouble figuring it out as well. Most of the manuals are a bit older and it seems there have been some small changes in newer versions of Zigbee2MQTT. That state.json file for example didnā€™t exist for me either.

As I was going through all the different videos and guides explaining how to install Zigbee2MQTT trying to figure out what I was doing wrong I noticed that in certain newer videos the MQTT field inside the Zigbee2MQTT was left blank.

When I tried that myself, everything started like normal with no errors in the logs. In the log for Zigbee2MQTT it does also still appear to connect to mqtt://core-mosquitto:1883 just fine.

So yeah, that solved it for me, but unsure if thatā€™s actually the correct way to fix it.

This was precisely my problem. However, I had never removed the stick but but suddenly the Sonoff stick was on port ttyUSB0 instead of ttyUSB1. So weird.

You donā€™t necessarily have to remove the stick for the port to change. Even a host restart could trigger it.

The only way to safeguard against this is to use the serial by id path instead of the ttyUSB in your integration config