-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_callbacks.py.example
More file actions
24 lines (21 loc) · 1.11 KB
/
user_callbacks.py.example
File metadata and controls
24 lines (21 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
##################################################################
##################################################################
###### Put any function in here to be used as a callback #########
##################################################################
##################################################################
def cb1(client, userdata, message, *args, **kwargs):
trigger_payload = "mytriggerpayload"
actual_payload = message.payload.decode("utf-8")
if actual_payload == trigger_payload:
print("THIS IS CB1, It is working")
#client.publish(message.topic, "") # clear topic by sending empty string if required
def cb2(client, userdata, message, *args, **kwargs):
trigger_payload = "mytriggerpayload" # whatever the payload needs to be to trigger the callback
actual_payload = message.payload.decode("utf-8")
if actual_payload == trigger_payload:
print("THIS IS CB2, It is working")
def cb3(client, userdata, message, *args, **kwargs):
trigger_payload = "mytriggerpayload"
actual_payload = message.payload.decode("utf-8")
if actual_payload == trigger_payload:
print("THIS IS CB3, It is working")