unixorn / ha-mqtt-discoverable

Python module to create MQTT entities that are automatically discovered by Home Assistant
Apache License 2.0
89 stars 21 forks source link

[BUG] Unable to connect to TLS broker with username and password #136

Closed trunet closed 9 months ago

trunet commented 9 months ago

Describe the bug I'm unable to connect to a TLS broker with an username and password.

To Reproduce Steps to reproduce the behavior: Use the following settings, tls_ca_cert is a Trusted CA list you have in your OS to validate the server certificate only. I don't want to set tls_key and tls_certfile because I don't want client certificate authentication.

mqtt_settings = Settings.MQTT(host=host,
                                  port=port,
                                  username=username,
                                  password=password,
                                  client_name=client_name,
                                  tls_ca_cert=tls_ca_cert)

Expected behavior It should allow to not specify tls_key and tls_certfile and connect to a TLS broker with an username and password.

Additional information Related code: https://github.com/unixorn/ha-mqtt-discoverable/blob/3c0cf77b34da7fe5eaeb92f800fc290a3c8e094b/ha_mqtt_discoverable/__init__.py#L675-L696