moved mqtt debug into rhede

This commit is contained in:
2021-12-04 10:37:10 +01:00
parent 3f9d019096
commit 56d644145b
2 changed files with 0 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe("Rover/Info")
client.subscribe("Rover/Warn")
client.subscribe("Rover/Error")
client.subscribe("Rover/Info")
def on_message(client, userdata, msg):
print(msg.topic+" -> "+str(msg.payload)[2:-1])
if __name__ == '__main__':
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect("192.168.1.2", 1883, 60)
client.loop_forever()
+23
View File
@@ -0,0 +1,23 @@
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
client.subscribe("Rover/Debug")
def on_message(client, userdata, msg):
print(msg.topic+" -> "+str(msg.payload)[2:-1])
if __name__ == '__main__':
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect("192.168.1.2", 1883, 60)
client.loop_forever()