mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-03 23:04:08 +01:00
tweak to display more info
Script still needs a ton of work to be useful
This commit is contained in:
parent
f9ceacdfa7
commit
02287b8909
1 changed files with 3 additions and 2 deletions
|
@ -13,12 +13,12 @@ sDevIDPat = re.compile('xw4/device/([\dA-F]+)')
|
||||||
|
|
||||||
# Define event callbacks
|
# Define event callbacks
|
||||||
def on_connect(client, userdata, flags, rc):
|
def on_connect(client, userdata, flags, rc):
|
||||||
print("rc: " + str(rc))
|
print('on_connect(): rc: {}'.format(rc))
|
||||||
|
|
||||||
def on_message(client, obj, msg):
|
def on_message(client, obj, msg):
|
||||||
match = sDevIDPat.match(msg.topic)
|
match = sDevIDPat.match(msg.topic)
|
||||||
if match:
|
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):
|
def on_publish(client, obj, mid):
|
||||||
print("mid: " + str(mid))
|
print("mid: " + str(mid))
|
||||||
|
@ -52,6 +52,7 @@ def main():
|
||||||
mqttc = makeClient()
|
mqttc = makeClient()
|
||||||
mqttc.username_pw_set('xwuser', password='xw4r0cks')
|
mqttc.username_pw_set('xwuser', password='xw4r0cks')
|
||||||
mqttc.connect(args.HOST, args.PORT)
|
mqttc.connect(args.HOST, args.PORT)
|
||||||
|
print('connected to {}:{}'.format(args.HOST, args.PORT))
|
||||||
# Start subscribe, with QoS level 2
|
# Start subscribe, with QoS level 2
|
||||||
for topic in g_topics:
|
for topic in g_topics:
|
||||||
mqttc.subscribe(topic, 2)
|
mqttc.subscribe(topic, 2)
|
||||||
|
|
Loading…
Reference in a new issue