Build payload before
This commit is contained in:
parent
8d1808d6e0
commit
98213ec000
1 changed files with 3 additions and 2 deletions
|
@ -49,11 +49,12 @@ def insert_json(provider, data, payload='', deveui=''):
|
||||||
notify(payload, deveui)
|
notify(payload, deveui)
|
||||||
|
|
||||||
def notify(payload='', deveui=''):
|
def notify(payload='', deveui=''):
|
||||||
|
notify="{}:{}".format(deveui, payload)
|
||||||
try:
|
try:
|
||||||
conn = psycopg2.connect("dbname=lorawan")
|
conn = psycopg2.connect("dbname=lorawan")
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
notify="{}:{}".format(deveui, payload)
|
|
||||||
cursor.execute("select pg_notify ('lora', %s)", (notify))
|
cursor.execute("select pg_notify ('lora', %s)", (notify, ))
|
||||||
cursor.connection.commit()
|
cursor.connection.commit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("DB Notify failed: %s" % e)
|
print("DB Notify failed: %s" % e)
|
||||||
|
|
Loading…
Reference in a new issue