commit f68b890f9043ff6a92a16c63fceaeeb02a51ded4 Author: dan Date: Sun Sep 5 15:59:36 2021 -0400 Initial Commit. Connects to MQTT and listens for assigned topics. diff --git a/main.py b/main.py new file mode 100644 index 0000000..445dc19 --- /dev/null +++ b/main.py @@ -0,0 +1,18 @@ +import paho.mqtt.client as mqtt + + +def on_message(client, userdata, message): + print(str(message.payload.decode("utf-8"))) + + +mqttBroker = 'icyn30.duckdns.org' +mqttPort = 1888 + +client = mqtt.Client("Notifer") + +client.connect(mqttBroker, mqttPort) + +client.subscribe("/Test/test") +client.on_message = on_message + +client.loop_forever() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ebd4492 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +paho-mqtt==1.5.1