Fix things
This commit is contained in:
parent
0eb460d6d0
commit
9834ad14a3
1 changed files with 14 additions and 5 deletions
19
web-to-db.py
19
web-to-db.py
|
@ -45,13 +45,22 @@ class testHTTPServer_RequestHandler(BaseHTTPRequestHandler):
|
|||
dev = self.devEUI(data)
|
||||
text = self.payload(data)
|
||||
|
||||
ws = websocket.create_connection("wss://home-safety-visual.eu-gb.mybluemix.net/rawmessage")
|
||||
ws.send("%s:%s" % (dev, text))
|
||||
ws.close()
|
||||
|
||||
# Working lora node
|
||||
if dev == "9CD90BB52B6A1D01":
|
||||
key, value = text.split("=")
|
||||
print("Trying to send: %s:%s" (key, value))
|
||||
ws = websocket.create_connection("wss://home-safety-visual.eu-gb.mybluemix.net/%s" % (key))
|
||||
ws.send("%s" % (value))
|
||||
ws.close()
|
||||
try:
|
||||
key, value = text.split("=")
|
||||
print("Trying to send: %s:%s" % (key, value))
|
||||
ws = websocket.create_connection("wss://home-safety-visual.eu-gb.mybluemix.net/%s" % (key))
|
||||
ws.send("%s" % (value))
|
||||
ws.close()
|
||||
|
||||
except ValueError:
|
||||
print("Cannot split: %s" % (text))
|
||||
|
||||
|
||||
def devEUI(self, data):
|
||||
root = ET.fromstring(data)
|
||||
|
|
Loading…
Reference in a new issue