Build payload before

This commit is contained in:
Nico Schottelius 2016-11-02 16:55:57 +01:00
parent 8d1808d6e0
commit 98213ec000
1 changed files with 3 additions and 2 deletions

View File

@ -49,11 +49,12 @@ def insert_json(provider, data, payload='', deveui=''):
notify(payload, deveui)
def notify(payload='', deveui=''):
notify="{}:{}".format(deveui, payload)
try:
conn = psycopg2.connect("dbname=lorawan")
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()
except Exception as e:
print("DB Notify failed: %s" % e)