mirror of
https://gitlab.com/fabinfra/fabaccess/actors/fablock.git
synced 2025-03-12 14:51:46 +01:00
Added: Encoding
This commit is contained in:
parent
608ed8ecd2
commit
d1ab8a6f0c
6
main.py
6
main.py
@ -5,7 +5,7 @@ import paho.mqtt.client as mqtt
|
||||
|
||||
def on_raw(args, actor_name, data):
|
||||
client = mqtt.Client("fablock_actor_%05d" % random.randint(0, 99999))
|
||||
|
||||
data = base64.b64decode(data + '==')
|
||||
|
||||
if args.user is not None:
|
||||
if args.password is None:
|
||||
@ -15,9 +15,9 @@ def on_raw(args, actor_name, data):
|
||||
|
||||
client.connect(args.host, args.port)
|
||||
|
||||
if data == "action: unlock":
|
||||
if data == b"action: unlock":
|
||||
client.publish("fablock/%05d/%05d/trigger" % (int(args.fablock), int(args.lock)), 0x00)
|
||||
elif data == "action: identify":
|
||||
elif data == b"action: identify":
|
||||
client.publish("fablock/%05d/%05d/identify" % (int(args.fablock), int(args.lock)), 0x00)
|
||||
else:
|
||||
print("Process actor called with unknown data %s" % data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user