From 98213ec000d1faa17a434b4603e61ceee0f10e9c Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 2 Nov 2016 16:55:57 +0100 Subject: [PATCH] Build payload before --- receiver/ttn-receiver.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/receiver/ttn-receiver.py b/receiver/ttn-receiver.py index 0e8a000..8c9ea2a 100644 --- a/receiver/ttn-receiver.py +++ b/receiver/ttn-receiver.py @@ -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)