From 02287b8909987bad2be7eb6bb268a7c9cbca7610 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 27 Aug 2020 11:39:43 -0700 Subject: [PATCH] tweak to display more info Script still needs a ton of work to be useful --- xwords4/relay/scripts/mqtt-showinplay.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xwords4/relay/scripts/mqtt-showinplay.py b/xwords4/relay/scripts/mqtt-showinplay.py index 924ccf5c9..08fc58564 100755 --- a/xwords4/relay/scripts/mqtt-showinplay.py +++ b/xwords4/relay/scripts/mqtt-showinplay.py @@ -13,12 +13,12 @@ sDevIDPat = re.compile('xw4/device/([\dA-F]+)') # Define event callbacks def on_connect(client, userdata, flags, rc): - print("rc: " + str(rc)) + print('on_connect(): rc: {}'.format(rc)) def on_message(client, obj, msg): match = sDevIDPat.match(msg.topic) if match: - print('for: {}, len: {}'.format(match.group(1), len(msg.payload))) + print('on_message(): for: {}, len: {}'.format(match.group(1), len(msg.payload))) def on_publish(client, obj, mid): print("mid: " + str(mid)) @@ -52,6 +52,7 @@ def main(): mqttc = makeClient() mqttc.username_pw_set('xwuser', password='xw4r0cks') mqttc.connect(args.HOST, args.PORT) + print('connected to {}:{}'.format(args.HOST, args.PORT)) # Start subscribe, with QoS level 2 for topic in g_topics: mqttc.subscribe(topic, 2)