From 5272903f88c143ebae29f84a5753a6f4ff266fc0 Mon Sep 17 00:00:00 2001 From: RapidCompiler <59367217+RapidCompiler@users.noreply.github.com> Date: Fri, 9 Oct 2020 13:24:12 +0530 Subject: [PATCH] Updated mqtt_subscribe.py Added the self parameter to the on_connect function. Changed MQTT_MSG to MQTT_TOPIC in line 31. --- mqtt_subscribe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mqtt_subscribe.py b/mqtt_subscribe.py index dbdbd8f..707d1f2 100644 --- a/mqtt_subscribe.py +++ b/mqtt_subscribe.py @@ -15,7 +15,7 @@ # Define on connect event function # We shall subscribe to our Topic in this function -def on_connect(mosq, obj, rc): +def on_connect(self, mosq, obj, rc): mqttc.subscribe(MQTT_TOPIC, 0) # Define on_message event function. @@ -28,7 +28,7 @@ def on_message(mosq, obj, msg): def on_subscribe(mosq, obj, mid, granted_qos): print("Subscribed to Topic: " + - MQTT_MSG + " with QoS: " + str(granted_qos)) + MQTT_TOPIC + " with QoS: " + str(granted_qos)) # Initiate MQTT Client mqttc = mqtt.Client()