Add notify for Loriot
This commit is contained in:
parent
598619f00c
commit
76f6fed0cc
1 changed files with 9 additions and 3 deletions
|
@ -21,14 +21,20 @@ class Loriot():
|
||||||
|
|
||||||
jdata = lorautil.jsonToDict(result)
|
jdata = lorautil.jsonToDict(result)
|
||||||
eui = self.devEUI(jdata)
|
eui = self.devEUI(jdata)
|
||||||
lorautil.insert_json("loriot", result, deveui=eui)
|
|
||||||
|
try:
|
||||||
|
payload = get_payload(jdata)
|
||||||
|
except Exception:
|
||||||
|
payload = ""
|
||||||
|
|
||||||
|
lorautil.db_insert_json("loriot", result, payload=payload, deveui=eui)
|
||||||
|
lorautul.db_notify("loriot", payload=payload, deveui=eui)
|
||||||
|
|
||||||
def devEUI(self, data):
|
def devEUI(self, data):
|
||||||
return data['EUI']
|
return data['EUI']
|
||||||
|
|
||||||
def get_payload(self, data):
|
def get_payload(self, data):
|
||||||
return ""
|
return bytes.fromhex(data['payload']).decode('utf-8')
|
||||||
# return data['EUI']
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
l = Loriot()
|
l = Loriot()
|
||||||
|
|
Loading…
Reference in a new issue