Luligu / matterbridge-zigbee2mqtt

Matterbridge zigbee2mqtt plugin
https://github.com/Luligu/matterbridge-zigbee2mqtt/blob/main/README.md
Apache License 2.0
76 stars 9 forks source link

fix: MQTT credentials are always set #81

Closed Teagan42 closed 20 hours ago

Teagan42 commented 3 weeks ago

Problem When authentication is disabled in EMQX, connection fails when username and password are defaulted to empty strings.

Description of Change

  1. Default the MQTT credentials to undefined.
  2. Check if username and password are truthy (non-null, defined, non-empty strings), if truthy apply username and password to MQTT options.
  3. Check if username is truthy (non-null, defined, non-empty string), if truthy apply username to the clientId MQTT option.
Luligu commented 3 weeks ago

Hi, thank you for your interest and your PR.

I agree with you about passing undefined instead of empty strings for both username and password.

I'm not sure about passing username without password... that is really connected to a specific setup. Do you need it?

Let me just check that mosquito has no issues with that cause it is the 99% of uses.

Btw I cannot merge on the main... only on the dev. But wait that I check mqtt code and test mosquito before making a PR on the dev.

My best.

Luligu commented 20 hours ago

[2.2.2] - 2024-10-22

Added

Changed

Fixed

Buy me a coffee

Hi sorry for the late reply. I made it differently. If you have time to test it, would be nice. I tested it with mosquitto and all is correct. The tgz is in discord. https://github.com/Luligu/matterbridge/blob/main/CHANGELOG.md#discord