Zigbee2mqtt cannot connect to mqtt broker after reading many topic i cannot fix it! I hope someone can help!

I moved to Zigbee2mqtt from zha to improve compatibility on some device but i cannot even make it work.
It run on a pi with HA (on the same raspberry one usb is working successfully with ZHA, i have a second usb dongle on another usb where i want to use zb2mqtt.
mqtt broker is installed and looks there are no error but it refuse the access to zb2mqtt
here the log and configuration (last tried of like 100 minor changes)

zb2mqtt:

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: bot
  Password: xxxxxx
serial:
  port: >-
    /dev/serial/by-id/usb-Silicon_Labs_Sonoff_Zigbee_3.0_USB_Dongle_Plus_0001-if00-port0
permit_join: true
frontend: true

Mosquitto configuration:

logins:
  - username: bot
    password: xxxxxx
require_certificate: false
certfile: fullchain.pem
keyfile: privkey.pem
customize:
  active: false
  folder: mosquitto

zb2mqtt log:

[Processing: 45df7312_zigbee2mqtt_2023-01-09T22-42-36.562Z.log...]()

[22:59:19] INFO: Preparing to start...
[22:59:20] INFO: Socat not enabled
[22:59:22] INFO: Starting Zigbee2MQTT...
Zigbee2MQTT:info  2023-01-09 22:59:28: Logging to console and directory: '/config/zigbee2mqtt/log/2023-01-09.22-59-28' filename: log.txt
Zigbee2MQTT:info  2023-01-09 22:59:28: Starting Zigbee2MQTT version 1.29.1 (commit #unknown)
Zigbee2MQTT:info  2023-01-09 22:59:28: Starting zigbee-herdsman (0.14.83)
Zigbee2MQTT:info  2023-01-09 22:59:29: zigbee-herdsman started (resumed)
Zigbee2MQTT:info  2023-01-09 22:59:29: Coordinator firmware version: '{"meta":{"maintrel":1,"majorrel":2,"minorrel":7,"product":1,"revision":20210708,"transportrev":2},"type":"zStack3x0"}'
Zigbee2MQTT:info  2023-01-09 22:59:29: Currently 0 devices are joined:
Zigbee2MQTT:info  2023-01-09 22:59:29: Zigbee: disabling joining new devices.
Zigbee2MQTT:info  2023-01-09 22:59:29: Connecting to MQTT server at mqtt://core-mosquitto:1883
Zigbee2MQTT:error 2023-01-09 22:59:29: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2023-01-09 22:59:29: MQTT failed to connect, exiting...
Zigbee2MQTT:info  2023-01-09 22:59:29: Stopping zigbee-herdsman...
Zigbee2MQTT:error 2023-01-09 22:59:30: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2023-01-09 22:59:31: MQTT error: Connection refused: Not authorized

mosquitto log:

2023-01-09 23:01:59: New connection from 172.30.33.3:44138 on port 1883.
error: received null username or password for unpwd check
2023-01-09 23:01:59: Client <unknown> disconnected, not authorised.
2023-01-09 23:02:00: New connection from 172.30.33.3:44148 on port 1883.
error: received null username or password for unpwd check

supervisor log:

23-01-09 23:01:44 INFO (SyncWorker_6) [supervisor.docker.addon] Starting Docker add-on zigbee2mqtt/zigbee2mqtt-aarch64 with version 1.29.1-1
23-01-09 23:01:44 WARNING (MainThread) [supervisor.addons.options] Unknown option 'base_topic' for Zigbee2MQTT (45df7312_zigbee2mqtt)
23-01-09 23:01:44 WARNING (MainThread) [supervisor.addons.options] Unknown option 'Password' for Zigbee2MQTT (45df7312_zigbee2mqtt)
23-01-09 23:01:44 WARNING (MainThread) [supervisor.addons.options] Option 'permit_join' does not exist in the schema for Zigbee2MQTT (45df7312_zigbee2mqtt)
23-01-09 23:01:44 WARNING (MainThread) [supervisor.addons.options] Option 'frontend' does not exist in the schema for Zigbee2MQTT (45df7312_zigbee2mqtt)
23-01-09 23:02:00 ERROR (MainThread) [asyncio] Task exception was never retrieved
future: <Task finished name='Task-99205' coro=<Addon.watchdog_container() done, defined at /usr/src/supervisor/supervisor/addons/addon.py:988> exception=AddonsJobError('Rate limit exceeded, more then 10 calls in 0:30:00')>
Traceback (most recent call last):
  File "/usr/src/supervisor/supervisor/addons/addon.py", line 1002, in watchdog_container
    await self._restart_after_problem(self, event.state)
  File "/usr/src/supervisor/supervisor/jobs/decorator.py", line 144, in wrapper
    raise on_condition(
supervisor.exceptions.AddonsJobError: Rate limit exceeded, more then 10 calls in 0:30:00
23-01-09 23:07:00 INFO (MainThread) [supervisor.host.info] Updating local host information
23-01-09 23:07:01 INFO (MainThread) [supervisor.host.services] Updating service information
23-01-09 23:07:01 INFO (MainThread) [supervisor.host.network] Updating local network information
23-01-09 23:07:01 INFO (MainThread) [supervisor.host.sound] Updating PulseAudio information
23-01-09 23:07:01 INFO (MainThread) [supervisor.host.manager] Host information reload completed
23-01-09 23:09:06 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
23-01-09 23:39:06 INFO (MainThread) [supervisor.homeassistant.api] Updated Home Assistant API token
1 Like

Just a wild guess, because I am as far from a Zigbee expert as Grandma is with Home Assistant.
Try the real IP address. My configuration has this:
server: mqtt://192.168.1.124:1883
(My MQTT broker is on a Raspberry Pi and my Home Assistant is on an Intel NUC).

just tested (using mqtt://“the pi IP where everything is running”)

server: mqtt://192.168.1.195:1883

same error

Zigbee2MQTT:info  2023-01-10 00:25:11: Connecting to MQTT server at mqtt://192.168.1.195:1883
Zigbee2MQTT:error 2023-01-10 00:25:11: MQTT error: Connection refused: Not authorized
Zigbee2MQTT:error 2023-01-10 00:25:11: MQTT failed to connect, exiting...

My guess would be you followed one set of instructions to configure the mosquito add-on and another for your Z2M integration, and the username and password for MQTT don’t match.

The username and password in Z2M:

base_topic: zigbee2mqtt
server: mqtt://192.168.0.100:1883
user: your_username
password: your_password

must match that configured in MQTT:

- username: your_username
  password: your_password

and also in the MQTT integration under broker settings.

2 Likes

Don’t know, if this is a copy 'n paste error or even if it does matter, but „Password:“ should be lower cased.

3 Likes

I can’t tell you if make or copied that error at the beginning but then it has ben invisible to me even if in front of my face for one week! Thank you!

Just to clarify to whoever will read this post in the future looking for a fix like I did with others here the working zigbee2mqtt configuration:

mqtt:
  base_topic: zigbee2mqtt
  server: mqtt://192.168.1.195:1883
  user: bot
  password: xxxxxx

They match it was the upper case of the P in “password”
Anyhow thank you!

1 Like