RoyOltmans / aqualin-mqtt-deamon

Lightweight aqualin BLE mqtt deamon controller
9 stars 4 forks source link

MQTT authentication #5

Open geojoh opened 4 years ago

geojoh commented 4 years ago

Hi, Is there any way to define the mqtt broker username and password. I tried specifying them in the config ini but still throws error 5.

georgeavd commented 3 years ago

Hi,

This can easily be solved by adding the 'client.username_pw_set()' function (see below) at the correct place in the 'aqualin-mqtt-deamon.py' file. ... .. #MQTT Startup client = mqtt.Client() client.on_connect = on_connect client.on_message = on_message client.username_pw_set(username="mqttuser",password="mqttpassword") client.connect(strmqtthost, intmqttport, 60) client.loop_forever()` ...

Change mqttuser and mqttpassword according to you MQTT-server configuration.