aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbigclown-leds8
1 files changed, 8 insertions, 0 deletions
diff --git a/bigclown-leds b/bigclown-leds
index 516515e..4d635fc 100755
--- a/bigclown-leds
+++ b/bigclown-leds
@@ -1,4 +1,7 @@
#!/usr/bin/env python3
+import configparser
+import sys
+
import paho.mqtt.client as mqtt
@@ -27,11 +30,16 @@ def on_message(client, userdata, msg):
def main():
+ cnf = configparser.ConfigParser()
+ cnf.read(sys.argv[1])
+ cnf_mqtt = cnf["mqtt"]
+
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
# client.on_log = on_log
+ client.username_pw_set(cnf_mqtt["username"], cnf_mqtt["password"])
client.connect("127.0.0.1", 1883, 60)
client.loop_forever()