Cannot use login and password with Zigbee2MQTT addon

Hi, I am newbie with HA, but I am a programmer and system engineer.

I am little bit confused about Zigbee2MQTT configuration. I installed current HA OS, Mosquitto broker and Zigbee2MQTT addons from the store and git repo. I read the documentation and I know, that new version of MQTT broker do not accept connections without authentication and username and password needs to be set.
I set credentials to MQTT broker same as Zigbee2MQTT.
MQTT broker running ok, but cannot start Zigbee2MQTT addon with error in the log:

Zigbee2MQTT:error 2023-06-14 10:39:37: MQTT error: Connection refused: Not authorized

Broker logs the appropriate error in the log too:

2023-06-14 10:39:37: New connection from on port 1883. error: received null username or password for unpwd check

When I check the broker via external application MQTT Explorer using credentials, everything works very well.

I made a little test with network packet sniffer using virtual external MQTT server and it looks like the Zigbee2MQTT addon does not send ANY credentials at all.

Packet from MQTT Explorer and from Zigbee2MQTT:

Msquitto broker settings:

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

Zigbee2MQTT settings:

data_path: /config/zigbee2mqtt
  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
  base_topic: zigbee2mqtt
  username: ****
  password: ****
  server: mqtt://core-mosquitto:1883
  port: /dev/ttyACM0
  zigbee_herdsman_debug: false

Does anybody kick me with an idea, what I am doing wrong?
Thank you very much.

Home Assistant 2023.6.1
Supervisor 2023.06.1
Operating System 10.2
Frontend 20230608.0 - latest
Mosquitto broker 6.2.1
Zigbee2MQTT 1.31.2-1

Assuming this is all on the same device - use the IP address for the server instead of core-mosquitto

Also format should be :

  base_topic: zigbee2mqtt
  server: mqtt://
  user: ****
  password: ****

You have put username instead of user.

Thank you, ‘user’ was the point :slight_smile:

1 Like