hvalev / dht22mqtt-homeassistant-docker

Docker container for the DHT11/DHT22/AM2302 sensors, able to relay sensor readings to a MQTT broker. Integrates with HomeAssistants' discovery protocol and incorporates a robust outlier detection scheme. All features are configurable, where the container can be used to simply log data too.
MIT License
7 stars 4 forks source link

add support for mqtt authentication #11

Closed fphammerle closed 3 years ago

fphammerle commented 3 years ago

My MQTT broker requires authentication.

I wrote if mqtt_username: instead of if mqtt_username and mqtt_password: or similar because the password is optional: https://github.com/eclipse/paho.mqtt.python/blob/v1.5.1/src/paho/mqtt/client.py#L1318

hvalev commented 3 years ago

Thanks! Looks good to me. It also shouldn't affect unauthenticated sessions.

fphammerle commented 3 years ago

thanks!