Use another port for Zigbee2MQTT dashboard?

I would like to use another port for Zigbee2MQTT in stead of 8080. So I can use that for another Docker container. How can I safely do that?

Hi,

In the integration page, go to ZigBee2MQTT’s configuration and click the second ‘modify’ button

Then you can select the used port !

Thank you!

1 Like

Sadly it didn’t work. :frowning:
Tried it both in Opera and Chrome on Win11.

I can’t change it to another port, it won’t change. The only thing that works is making the field empty. It then selected port 12000. I also couldn’t change it back to 8080

After that the services couldn’t talk to each other and there are errors in the log. Couldn’t open the Z2M dashboard either.

Errors:

2025-12-10T17:08:16+0100 <info> installZ2mContainer.js:90 (Zigbee2mqttManager.installZ2mContainer) Zigbee2mqtt container successfully started
2025-12-10T17:08:16+0100 <info> connect.js:17 (Zigbee2mqttManager.connect) Disconnecting existing MQTT client...
2025-12-10T17:08:16+0100 <info> connect.js:25 (Zigbee2mqttManager.connect) Connecting Gladys to mqtt://localhost:1884 MQTT broker...
2025-12-10T17:08:16+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:16+0100 <warn> connect.js:53 (MqttClient.<anonymous>) Disconnected from MQTT server
2025-12-10T17:08:17+0100 <info> system.isDocker.js:13 (System.isDocker) System.isDocker: This system is running inside Docker.
2025-12-10T17:08:21+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:26+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:31+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:36+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:41+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:46+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:51+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:08:56+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized
2025-12-10T17:09:01+0100 <warn> connect.js:46 (MqttClient.<anonymous>) Error while connecting to MQTT - Error: Connection refused: Not authorized

Ils the z2m interface accessible on port 12000?

No. ERR_CONNECTION_REFUSED

Try stopping the service using activate/deactivate toggle then restart it.

Wait until all containers are good as they will be re-downloaded then re-created (a few mins)

They are both running OK now. But I still can’t reach the Z2M dashboard. No errors in the logs.

What says the docker ps -a command ? (We’re looking at the used ports)

CONTAINER ID   IMAGE                                               COMMAND                  CREATED              STATUS                             PORTS                                                                                                                                     NAMES

a32acb4039e9   koenkk/zigbee2mqtt:2.6.1                            « docker-entrypoint.s… »   About an hour ago    Up About an hour                                                                                                                                                             gladys-z2m-zigbee2mqtt

f7482e46285f   eclipse-mosquitto:2.0.15                            « /docker-entrypoint.… »   About an hour ago    Up About an hour                                                                                                                                                             gladys-z2m-mqtt

085b6f213e91   gladysassistant/gladys:latest                       « docker-entrypoint.s… »   About an hour ago    Up About an hour                                                                                                                                                             gladys

Running this:

sudo docker run -d \
--log-driver json-file \
--log-opt max-size=10m \
--cgroupns=host \
--restart=always \
--privileged \
--network=host \
--name gladys \
-e NODE_ENV=production \
-e SERVER_PORT=8001 \
-e TZ=Europe/Amsterdam \
-e SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-production.db \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/gladysassistant:/var/lib/gladysassistant \
-v /dev:/dev \
-v /run/udev:/run/udev:ro \
gladysassistant/gladys:latest

Try this one to see what front-end port is configured:

sudo nano /var/lib/gladysassistant/zigbee2mqtt/z2m/configuration.yaml

@NoiZe
if I’m not mistaken and if you’re using Gladys’ MQTT and zigbee2mqtt services (so internal services) then you should have:

Gladys: port 8001 (according to your docker command line)

MQTT: 1884 (that’s what your log says and Gladys can’t connect to it because maybe a login and/or password error)

Zigbee2mqtt: port 12000

Small note: you have zigbee2mqtt version 2.6.1, which means either you don’t have the Gladys update that now uses 2.7.1, or you have an external zigbee2mqtt.

Another point, I believe you had a connection issue with your zigbee dongle. Did you change ZBDongle-P to ZBDongle-E to test?
As long as zigbee2mqtt can’t connect to the dongle, it will restart endlessly and the system won’t work.

In short, with all that, none of these services use port 8080, so I think you have something else on your machine using that port and it’s not Gladys Assistant and its services.

I’m running MQTT and Z2M inside Gladys. Tried a manual update from cli, it updated to the latest version, also z2m to 2.7.1. Everything is connected and working, except the z2m management page.

/var/lib/gladysassistant/zigbee2mqtt/z2m/configuration.yaml:
Front-end port: 12000

Changed it to 8080 in the file and still get connection refused somehow.
In the GUI it changed into 8080. Still cannot change the port in the GUI itself. :expressionless:

P.s. I had problems with a zigbee dongle, but bought this new one that works fine.

Log after reboot and docker purge (nevermind the Hue error):

2025-12-10T21:01:04+0100 <info> index.js:149 (Object.duckDbShowVersion) DuckDB version = v1.4.1
2025-12-10T21:01:04+0100 <info> index.js:98 (Object.duckDbCreateTableIfNotExist) DuckDB - Creating database table if not exist
2025-12-10T21:01:04+0100 <info> job.purge.js:17 (Job.purge) Deleting all background jobs created before = Wed Dec 03 2025 21:01:04 GMT+0100 (Central European Standard Time)
2025-12-10T21:01:04+0100 <info> system.setDuckDbTimezone.js:14 (System.setDuckDbTimezone) Setting DuckDB timezone to Europe/Amsterdam
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service alexa was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service caldav was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service openweather was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service ecowatt was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service enedis was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service rtsp-camera was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service telegram was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service usb was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service xiaomi was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service bluetooth was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service ewelink was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service tp-link was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service google-actions was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service homekit was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service broadlink was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service lan-manager was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service nextcloud-talk was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service tuya was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service melcloud was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service node-red was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service netatmo was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service sonos was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service zwavejs-ui was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service google-cast was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service airplay was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service free-mobile was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service edf-tempo was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service mqtt was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> service.startAll.js:30 () Service example was manually stopped, so it is ignored at startup
2025-12-10T21:01:10+0100 <info> index.js:15 (Object.start) Starting energy monitoring service
2025-12-10T21:01:10+0100 <info> index.js:29 (Object.start) Starting MCP service
2025-12-10T21:01:11+0100 <info> index.js:18 (Object.start) Starting Matter service
2025-12-10T21:01:11+0100 <info> index.js:21 (Object.start) Matter is not enabled
2025-12-10T21:01:11+0100 <info> system.isDocker.js:13 (System.isDocker) System.isDocker: This system is running inside Docker.
2025-12-10T21:01:11+0100 <info> init.js:63 (Zigbee2mqttManager.init) Zigbee2mqtt USB dongle attached to /dev/ttyUSB0
2025-12-10T21:01:11+0100 <info> checkForContainerUpdates.js:14 (Zigbee2mqttManager.checkForContainerUpdates) Checking for current installed versions and required updates...
2025-12-10T21:01:11+0100 <info> installMqttContainer.js:114 (Zigbee2mqttManager.installMqttContainer) MQTT broker container successfully started
2025-12-10T21:01:11+0100 <info> configureContainer.js:23 (Zigbee2mqttManager.configureContainer) Z2M Docker container is being configured...
2025-12-10T21:01:11+0100 <info> configureContainer.js:36 (Zigbee2mqttManager.configureContainer) Z2M configuration file already exists.
2025-12-10T21:01:11+0100 <info> installZ2mContainer.js:90 (Zigbee2mqttManager.installZ2mContainer) Zigbee2mqtt container successfully started
2025-12-10T21:01:11+0100 <info> connect.js:25 (Zigbee2mqttManager.connect) Connecting Gladys to mqtt://localhost:1884 MQTT broker...
2025-12-10T21:01:11+0100 <info> connect.js:35 (MqttClient.<anonymous>) Connected to MQTT container mqtt://localhost:1884
2025-12-10T21:01:11+0100 <info> subscribe.js:12 (Zigbee2mqttManager.subscribe) Subscribing to MQTT topic zigbee2mqtt/#
2025-12-10T21:01:11+0100 <info> index.js:15 (Object.start) Starting Tasmota service
2025-12-10T21:01:11+0100 <info> index.js:18 (Object.start) Starting Philips Hue service
2025-12-10T21:01:11+0100 <info> index.js:14 (Object.start) Starting CallMeBot service
2025-12-10T21:01:12+0100 <info> scene.dailyUpdate.js:58 () Sunrise today is at 8:37 today, in your timezone = Europe/Amsterdam
2025-12-10T21:01:12+0100 <info> scene.dailyUpdate.js:59 () Sunset today is at 16:28 today, in your timezone = Europe/Amsterdam
2025-12-10T21:01:12+0100 <info> scene.dailyUpdate.js:70 () The sun rose this morning. Not scheduling for today.
2025-12-10T21:01:12+0100 <info> scene.dailyUpdate.js:84 () The sun has already set. Not scheduling for today.
2025-12-10T21:01:12+0100 <warn> light.init.js:29 () Unable to connect to Philips Hue bridge "Hue Bridge"
2025-12-10T21:01:12+0100 <info> device.migrateFromSQLiteToDuckDb.js:36 (DeviceManager.migrateFromSQLiteToDuckDb) DuckDB : Already migrated from SQLite. Not migrating.
2025-12-10T21:01:12+0100 <info> system.checkIfGladysUpgraded.js:17 (System.checkIfGladysUpgraded) Gladys just upgraded from null to v4.66.1
2025-12-10T21:01:12+0100 <error> system.checkIfGladysUpgraded.js:44 (System.checkIfGladysUpgraded) ServiceNotConfiguredError: Telegram not configured
    at MessageHandler.send (/src/server/services/telegram/lib/message.send.js:17:11)
    at MessageHandler.sendToUser (/src/server/lib/message/message.sendToUser.js:38:35)
    at /src/server/lib/system/system.checkIfGladysUpgraded.js:26:9
2025-12-10T21:01:12+0100 <info> index.js:64 (Server.<anonymous>) Server listening on port 8001

If I do a sudo ss -tunlp I can see there are no processes using port 8080. I do see the 8001 (Gladys) and 1884 (MQTT) ones.

I did a curl ``http://localhost:8080 on the Pi and inside the containers and got this response:
curl: (7) Failed to connect to localhost port 8080 after 0 ms: Could not connect to server

Also checked inside the containers for open ports and did not see the 8080 one.

Since it was working fine on port 8080, before I changed it in the GUI to something else, could it be something that went wrong there?

According to your logs, everything is ok now for Z2M and MQTT!
However I’m stumped about the port :roll_eyes:
On my end I connect to http://ip-de-gladys:12000 and Z2M appears.

Is there on your system an open port 12000 (or 8080) inside or outside the containers?

No, I don’t have

Translation errors, apparently — I fixed them by hand!

Found some mentions of it on the Z2M Github. Maybe the port isn’t binding.

My solution was this

frontend: enabled: true port: 8080 host: 0.0.0.0

seems like the newest update isn’t automatically binding the container port to 0.0.0.0:8080 … annoying but whatever. Add that to your configuration.yaml and it works.

Check comment

Maybe that’s the case with the configuration.yaml that Gladys uses?

My configuration.yaml contains only :

frontend:
  enabled: true
  port: 8080

And it works fine

I’m not sure it’s the issue here!