- if command == "on":
- if id == '.':
- mtrf_command = { "mode": 2, "ch": channel, "cmd": 2, "ctr": 1 }
- elif id:
- mtrf_command = { "mode": 2, "ch": channel, "cmd": 2, "id0": int(id[0:2],16), "id1": int(id[2:4],16), "id2": int(id[4:6],16), "id3": int(id[6:8],16), "ctr": 8 }
- else:
- mtrf_command = { "mode": 0, "ch": channel, "cmd": 2 }
+
+ mtrf_command = { "ch": channel }
+ if id == '.' or id == 'TX-F':
+ mtrf_command["mode"] = 2
+ elif id =='TX':
+ mtrf_command["mode"] = 0
+ elif id =='RX':
+ mtrf_command["mode"] = 1
+ elif id =='RX-F':
+ mtrf_command["mode"] = 3
+ elif id:
+ mtrf_command["mode"] = 2
+ mtrf_command["ctr"] = 8
+ mtrf_command["id0"] = int(id[0:2],16)
+ mtrf_command["id1"] = int(id[2:4],16)
+ mtrf_command["id2"] = int(id[4:6],16)
+ mtrf_command["id3"] = int(id[6:8],16)
+ else:
+ mtrf_command["mode"] = 0
+
+ if command == "power":
+ payload = payload.decode('utf-8').lower()
+ print( "command: POWER " + payload )
+ if payload == "off" or payload == "0":
+ mtrf_command["cmd"] = 0
+ else:
+ mtrf_command["cmd"] = 2
+
+ elif command == "on":
+ mtrf_command["cmd"] = 2
+