-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Zigbee2mqtt Cannot Connect to MQTT server #460
Comments
You can try using https://github.com/zigbee2mqtt/hassio-zigbee2mqtt as repo and install the add-on from there and just keep:
And allow the add-on to auto-discover mqtt. See if that works. |
I've got the same issue, since the update. Do I really need to reinstall the whole thing? Can I roll back to 1.15.0? |
Rollback to 1.15.0 is not easy. You would need to fork the repo and update some versions, but "reinstall" is not really that costly. As long as you backup your config, rest of settings should be on the storage in zigbee2mqtt folder and should work. I really recommended to try https://github.com/zigbee2mqtt/hassio-zigbee2mqtt and install 1.16.0 from there because it contains mqtt auto discovery with the settings mentioned above. |
I did some digging on this, and a temporary fix seems to be to enable authentication on the MQTT server (you can leave anonymous enabled too) and to use a username/password on zigbee2mqtt. It turns out that this is a bug introduced in the new version of MQTT.js which zigbee2mqtt updated to in 1.16.0, and it only exhibits itself when connecting to the Mosquitto Home Assistant Add-on (something to do with the auth plugin it uses it seems). I've opened mqttjs/MQTT.js#1197 to fix the issue in the library, which zigbee2mqtt can use once it has been merged. |
Thanks for your feedback guys. @ciotlosm I have also swapped now to https://github.com/zigbee2mqtt/hassio-zigbee2mqtt. In this, as suggested, I have let the auto discover run. This seemed to connect to the mqtt server. However when I push a zigbee button the data comes up in the log. It says the button has been pushed:
I am running MQTT explorer connected to the same broker and I get nothing. Needless to say nothing else works either. |
@haemishkyd if you see the logs for mqtt, it means stuff is working. Are you sure you are looking at the right topic with MQTT explorer? |
@ciotlosm I'm seeing the same behavior. Log output from Supervisor -> z2m -> Log
In another tab running z2m MQTT config:
|
#metoo |
@bigboban what steps did you have to take to downgrade though the add ons? |
Tagging @Koenkk as this might be related to libraries in zigbee2mqtt |
If it helps at all, I bisected this down to Koenkk/zigbee2mqtt#4830 in the end (mqtt 4.2.2 introduced the issue). mqttjs/MQTT.js#1197 has an explanation of the issue I was seeing. |
@UnderpantsGnome Downgraded using selective restore from snapshot - only this plugin. |
@jackwilsdon big thanks for your investigation here, can this be fixed by downgrading mqtt 4.2.1? If yes I will push an update today which will be available in the edge version. |
@Koenkk downgrading to 4.2.1 with
It might be best pinning it to 4.2.1 in |
@jackwilsdon great, I've released a new Zigbee2MQTT version: 1.16.1 @ciotlosm can you trigger a new release? |
I can confirm that 1.16.1 fixes the issue for me, thanks! |
@Koenkk new build is finished and published. @haemishkyd can you confirm new version fixes your issue? @Koenkk off topic: How can I get edge pipeline to trigger on the new repo in sync with your dev branch? Are you running them yourself at the moment? https://github.com/zigbee2mqtt/hassio-zigbee2mqtt I'm preparing for doing a switch in the near future to the repo and that is one of the features missing. Currently build times in the new repo are faster, and the workflow is fixed (publish of version can be done after build is finished). As it can be seen the build times are vastly improved
Also a few other improvements visible in changelog like mqtt auto discovery. |
1.16.1 resolves the auth issue, but I still don't get data published to the MQTT broker, I can see things updating on the z2m frontend. 🤷♂️ |
Can you add one for https://dev.azure.com/zigbee2mqtt/Zigbee2mqtt%20Add-on/_build?definitionId=9 as well please? |
@UnderpantsGnome do you have any ACLs configured? Try connecting to the MQTT sever with another client using the credentials you're using with zigbee2mqtt and see if messages published by that client can be seen by others. |
@jackwilsdon no ACL setup, anonymous logins, I can publish fine from MQTT.fx, nothing else has changed other than the upgrade to 1.16 yesterday. z2m config. data_path: /share/zigbee2mqtt
external_converters: []
devices: devices.yaml
groups: groups.yaml
homeassistant: true
permit_join: true
mqtt:
base_topic: zigbee2mqtt
server: 'mqtt://10.0.0.34'
serial:
port: /dev/ttyUSB0
advanced:
log_level: info
pan_id: 6754
channel: 11
network_key:
- 1
- 3
- 5
- 7
- 9
- 11
- 13
- 15
- 0
- 2
- 4
- 6
- 8
- 10
- 12
- 13
availability_blocklist: []
availability_passlist: []
device_options: {}
blocklist: []
passlist: []
queue: {}
frontend:
port: 8099
experimental:
new_api: true
socat:
enabled: false
master: 'pty,raw,echo=0,link=/dev/ttyZ2M,mode=777'
slave: 'tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5'
restartdelay: 1
initialdelay: 1
options: '-d -d'
log: false broker config
|
We might be best taking this to the zigbee2mqtt discourse - it's a bit easier to discuss it there. |
I'll close the item as the auth is fixed. |
Hi I just upgraded it via docker on 1.16.1 Zigbee2MQTT and after that all my devices goes unvailable on HA :( I didn't understand if it's an issue about zigbee2mqtt or HA addon MQTT ? I'm using Home Assistant with Docker and Zigbee2MQTT with Docker. @UnderpantsGnome Do you have created an issue for this ? Somewhere ? I'm a little bit confused about this issue. I force for the moment the v1.15.0 of Zigbee2MQTT with docker to reload the old version and everything works again. Regards |
@kevincaradant I completely removed the addon, and the repo for it, then added them back in (to be sure I was using the correct repo) and things started working again. |
I tried twice your solution but that doesn't seems works well :/ Indisponible = unavailable So something wrong I got this error for each device connected:
|
For those that are still having problems getting their device data, I was able to reproduce one of the scenarios. The steps to reproduce would be:
The issue is that when upgrading zigbee2mqtt, on restart it will send "offline" state for all devices when shutting down. This is sent with a retain flag. When home assistant starts, it will see the retain flag, and start with all devices unavailable for zigbee2mqtt integration. Even if zigbee2mqtt is connected to home assistant via mqtt and messages are working, your devices will not update. To fix this you must restart zigbee2mqtt once to make sure that the You might want to look at https://www.zigbee2mqtt.io/information/availability.html and try some settings to fix this. For those that are still having problems, please open a new issue with the right details. |
Thanks you @ciotlosm I was not using the latest version of Home Assistant because I got some issues with it until the last month but I retried today to update HA and everything works as expected 👍 Then I upgraded Zigbee2MQTT in 1.16.1 and I restarted it. HA is still working as expected so that's good. Pb solved |
Hi, I have followed all the advice given here (I think) and still nothing will publish to the MQTT broker.
My Zigbee2MQTT config:
My mosquitto config:
I have tried so many permutations of this now but still I can't seem to get this to work. Any thoughts or help would be appreciated. |
@haemishkyd What's in your mosquitto customize folder? (I notice you have it enabled) Are there any ACLs in there? |
@haemishkyd I'd recommend you try the version with auto-discovery and allow it to fetch the users for you (https://github.com/zigbee2mqtt/hassio-zigbee2mqtt) and see how that works. Also please post logs when opening an issue. |
Hello, @ciotlosm I am using the version with auto-discovery. My apologies. I should have added logs. Please see the logs after a restart:
You will see at the end of the log I pushed a button. This publication is not seen on any MQTT sniffer. I am using two different ones on my network. If I publish from any other client I see the message in these MQTT sniffers. @jackwilsdon my accesscontrolist file contains:
and acl.conf file:
|
Reference for acl file contents: https://mosquitto.org/man/mosquitto-conf-5.html#idm45473494697792 For 1.16.1 you shouldn't need to use authentication anyway now, so feel free to remove it again. |
Thanks for the advice I will try that. |
There was an issue in zigbee2mqtt 1.16.0 where anonymous users no longer worked. This has been fixed in 1.16.1. I'm not sure how the addon user works, as I've not used the autodiscovery version of the addon. You should be able to add whatever the addon user's name is to your acl file as I listed above though. |
Thanks for the advice. It seems to have been an issue with the ACLs as suggested. |
I experienced high CPU (100%) after upgrading to 5.1.1 (from the Official add-ons) I could not pinpoint the issue to any specific component. I stopped the zigbee2mqtt and OpenZwave - This got the CPU down to the usual 0.2% Once in a while I get some: "Socket error on client , disconnecting." from my OpenZwave add-on. Only problem now: Do I dare to upgrade to 5.1.1 ;-) - I will probably wait some weeks.. |
zigbee2mqtt add-on version (if edge, please report commit hash): 1.16.0
Operating environment (HassOS, Virtual Machine, Device/platform running Home Assistant):
HassOS 4.15
Home Assistant 0.117.2
Mosquitto broker 5.1
Description of problem:
I upgraded to 1.16.0 earlier and suddenly my system cannot connect to the MQTT broker. It now continues to give me.
Zigbee2MQTT:error 2020-11-03 21:29:05: Not connected to MQTT server!
I have looked through the change logs and nothing specific is mentioned about MQTT broker changes. The exact configuration given below was working perfectly on version 1.15.0.
I have tried using core-mosquitto, localhost and the actual ip address with and without the port. None of this works.
Has anything changed in the system to suggest what might be the issue here.
Your entire configuration from the frontend (with sensitive fields redacted):
Your logs from Home Assistant
The text was updated successfully, but these errors were encountered: