aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mqtt_watch.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/mqtt_watch.py')
-rw-r--r--scripts/mqtt_watch.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/mqtt_watch.py b/scripts/mqtt_watch.py
index 371debd..d61ecc0 100644
--- a/scripts/mqtt_watch.py
+++ b/scripts/mqtt_watch.py
@@ -11,6 +11,8 @@ mqtt_server = os.environ['el_mqtt_server']
mqtt_port = int(os.environ['el_mqtt_port'])
keepalive = int(os.environ['el_mqtt_keepalive'])
mqtt_topic = os.environ['el_mqtt_topic']
+mqtt_user = os.environ['el_mqtt_user']
+mqtt_pass = os.environ['el_mqtt_pass']
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
@@ -45,6 +47,8 @@ client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
+client.username_pw_set(mqtt_user, password=mqtt_pass)
+
client.connect(mqtt_server, mqtt_port, keepalive)
# Blocking call that processes network traffic, dispatches callbacks and