From 4a0c157fb467ea990550713e9793024a6ecacbf2 Mon Sep 17 00:00:00 2001 From: "S. Seegel" Date: Mon, 22 Feb 2021 22:32:07 +0100 Subject: [PATCH] change default port for lacrossegw --- apps/lacrossegw.conf | 2 +- apps/lacrossegw.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/apps/lacrossegw.conf b/apps/lacrossegw.conf index dd606fb..f446685 100644 --- a/apps/lacrossegw.conf +++ b/apps/lacrossegw.conf @@ -91,5 +91,5 @@ }, "webport": 8081, - "apiport": 1900 + "apiport": 1901 } diff --git a/apps/lacrossegw.py b/apps/lacrossegw.py index 7348bf7..60ceef5 100755 --- a/apps/lacrossegw.py +++ b/apps/lacrossegw.py @@ -22,7 +22,6 @@ except ImportError: import socketserver from http.server import SimpleHTTPRequestHandler as Handler from urllib.parse import urlparse, parse_qs - lock = threading.Lock() @@ -43,9 +42,9 @@ else: try: from influxdb import InfluxDBClient influxClient = InfluxDBClient( - host=config["influxdb"]["host"], - port=config["influxdb"]["port"], - username=config["influxdb"]["user"], + host=config["influxdb"]["host"], + port=config["influxdb"]["port"], + username=config["influxdb"]["user"], password=config["influxdb"]["pass"] ) @@ -175,7 +174,7 @@ class MyHttpRequestHandler(Handler): self.end_headers() resp = {"sensors": []} idlist = [] - + lock.acquire() for csens in config["sensors"]: id = csens["id"] @@ -199,7 +198,7 @@ class MyHttpRequestHandler(Handler): lock.release() self.wfile.write(json.dumps(resp).encode()) - + def do_GET(self): url = urlparse(self.path) p = url.path @@ -242,7 +241,7 @@ server_thread = threading.Thread(target=server.serve_forever) server_thread.daemon = True server_thread.start() -p = config["apiport"] if "apiport" in config else 1990 +p = config["apiport"] if "apiport" in config else 1991 apisrv = apiserver.ApiServer(p) print("Waiting for sensors...") @@ -315,7 +314,7 @@ while 1: payload["tMin"] = T if payload["tMax"] < T: payload["tMax"] = T - + cache[id]["payload"] = payload cache[id]["ts"] = datetime.now()