Closed rjmediallp closed 2 years ago
MQTT failed to connect: Connection refused: Not authorized
your mqtt credential are incorrect.
See, I thought that too!
MQTT broker uses the HA user I set up. That's configured in the Zigbee2Mqtt config. I confirmed it's working by using that login on an MQTT explorer on the windows PC.
mqtt:
base_topic: zigbee2mqtt,
user: mqtt-user,
password: *******,
server: mqtt://core-mosquitto:1883
The above is the login used and confirmed working.
I'm stumped. This only started happening after the update.
/edit - I changed the user and server back to what it was previously to see if that helped. It didn't.
error log as it stands....
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] socat.sh: executing...
[17:51:39] INFO: Socat not enabled, marking service as down
[cont-init.d] socat.sh: exited 0.
[cont-init.d] zigbee2mqtt.sh: executing...
[17:51:42] INFO: MQTT available, fetching server detail ...
[17:51:43] INFO: Previous config file found, checking backup
[17:51:43] INFO: Creating backup config in '/config/zigbee2mqtt/.configuration.yaml.bk'
[17:51:44] INFO: Adjusting Zigbee2mqtt core yaml config with add-on quirks ...
[cont-init.d] zigbee2mqtt.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[17:51:48] INFO: Handing over control to Zigbee2mqtt Core ...
> zigbee2mqtt@1.22.2 start
> node index.js
Zigbee2MQTT:error 2022-01-31 17:52:08: MQTT failed to connect: Connection refused: Not authorized
Zigbee2MQTT:error 2022-01-31 17:52:08: Exiting...
[17:52:22] INFO: Handing over control to Zigbee2mqtt Core ...
> zigbee2mqtt@1.22.2 start
> node index.js
Zigbee2MQTT:error 2022-01-31 17:52:39: MQTT failed to connect: Connection refused: Not authorized
Zigbee2MQTT:error 2022-01-31 17:52:39: Exiting...
[17:52:54] INFO: Handing over control to Zigbee2mqtt Core ...
> zigbee2mqtt@1.22.2 start
> node index.js
Would there be anything between 1.17 and 1.22 which would break the listening on the server:1883 or something? It's definitely working as I said, I can see the other MQTT elements reporting back.
Update: I kept all user settings and MQTT broker as-is... then removed the Zigbee2Mqtt plugin. I noticed I had a repository from both the z2m website as well as the github one. I removed the website repo and installed 1.22.2-1 from github. I then added the mqtt user which I know connects fine and it's all working again. No idea if that was the problem (having two repos and possibly installing a website version rather than the github?) Closing now.
@rjmediallp I'm having the same issue seems @Koenkk just gave a generalised answer that wasn't very helpful. What do you mean website repo and GitHub repo? can you make a list of what you did to fix this, driving me insane
@henrikrox in my case i had the config for zigbee 2 mqtt like this mqtt: base_topic: zigbee2mqtt user: mqtt-user pass: mqtt-pass server: mqtt://core-mosquitto:1883
And changed it to
mqtt: base_topic: zigbee2mqtt user: "mqtt-user" password: "mqtt-pass" server: mqtt://core-mosquitto:1883
that worked for me.
In case anyone has a similar login issue;
My system crashed and I had to do a fsck -f
filesystem repair to get it all back up. Afterwards the only thing that was broken in my setup was the Mosquitto broker. It would not accept the login I had been using for years (not via MQTT Explorer nor Zigbee2MQTT).
TL;DR; I simply changed the login a little, restarted Mosquitto and it started working again.
I have found similar problem within my setup. I have supervised version of Homeassistant on RPI4 and after a reboot I need to manually restart MQTT add-on.. 1st attempt to start failing with "Not authorized ..." message for other messages and also from outside (MQTT Explorer) I could not connect to ..
I have found similar problem within my setup. I have supervised version of Homeassistant on RPI4 and after a reboot I need to manually restart MQTT add-on.. 1st attempt to start failing with "Not authorized ..." message for other messages and also from outside (MQTT Explorer) I could not connect to ..
Same here, I solved it by restarting Mosquitto
I have found similar problem within my setup. I have supervised version of Homeassistant on RPI4 and after a reboot I need to manually restart MQTT add-on.. 1st attempt to start failing with "Not authorized ..." message for other messages and also from outside (MQTT Explorer) I could not connect to ..
Same here, I solved it by restarting Mosquitto
The solution I have found is:
add into configuration.yaml
mqtt: broker: "core-mosquitto" username: "username" password: "password"
Now it survives restart without any additional user interaction needed ...
For me it was that I had the original files in configuration.yaml in **share\zigbee2mqtt\ and after the update it looked at \config**\zigbee2mqtt. In that configuration.yaml file, there was no password.
In my case the problem with "not authorized MQTT fail" was in mosquitto configuration. Everything work after add in mosquitto brocker:
loggins:
- username: mqtt-user
password: Anim@lsH0m3
For future travelers. Mine was a password issue. In other words, I think I had a special character that, when I entered it into the MQTT password space, it invalidated the YAML structure. When I changed my password to something a bit more mundane, it was able to enter and worked perfectly.
For future future travellers, essentially make your password alphanumeric only (I had a # in mine that likely borked it), and be sure to change it on both ends. Reconfigure the MQTT integration and the Zigbee2mqtt side either in settings>MQTT, or in the configuration.yaml. I was initially struggling because I forgot the MQTT integration side.
@henrikrox in my case i had the config for zigbee 2 mqtt like this mqtt: base_topic: zigbee2mqtt user: mqtt-user pass: mqtt-pass server: mqtt://core-mosquitto:1883
And changed it to
mqtt: base_topic: zigbee2mqtt user: "mqtt-user" password: "mqtt-pass" server: mqtt://core-mosquitto:1883
that worked for me.
Thanks mate! it worked for me too ! :)
In my case the problem with "not authorized MQTT fail" was in mosquitto configuration. Everything work after add in mosquitto brocker:
loggins: - username: mqtt-user password: Anim@lsH0m3
this sorted out my issue as well. thank you.
In my case the problem with "not authorized MQTT fail" was in mosquitto configuration. Everything work after add in mosquitto brocker:
loggins: - username: mqtt-user password: Anim@lsH0m3
this sorted out my issue as well. thank you.
Thank you so much ! It worked !
What happened?
I updated zigbee2mqtt today (from 1.17 I think to 1.22.2-1) and having restarted, I get an error message "MQTT failed to connect: Connection refused: Not authorized".
What did you expect to happen?
MQTT connects and plugin starts up
How to reproduce it (minimal and precise)
Deleted zigbee2mqtt from home assistant. Added the new repository address and installed v1.22.2-1. Added my Sonof USB adaptor and restarted the plugin.
Home assistant core: 2021.12.10 Supervisor: 2021-12.2 Mosquitto broker v6.0.1
Zigbee2mqtt config:
I should add that I've tried different servers (with and without). The default previous which worked was "server": "mqtt://core-mosquitto:1883",
Zigbee2MQTT version
1.22.2-1
Adapter firmware version
unknown - bad gateway
Adapter
ITead Sonoff Zigbee 3.0 USB Dongle Plus
Debug log