From 759b31c9b9da20616c0fbcd7a55f1dfd815be1ea Mon Sep 17 00:00:00 2001 From: "S. Seegel" Date: Wed, 13 Jan 2021 00:39:22 +0100 Subject: [PATCH] configurable ports --- apps/lacrossegw.conf | 11 +++++++---- apps/lacrossegw.py | 7 ++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/apps/lacrossegw.conf b/apps/lacrossegw.conf index 29b90f6..dd606fb 100644 --- a/apps/lacrossegw.conf +++ b/apps/lacrossegw.conf @@ -55,7 +55,7 @@ "idOutside": "64" }, { - "id": "b0", + "id": "88", "name": "Kinderzimmer", "tMin": 19.5, "tMax": 24, @@ -64,7 +64,7 @@ "idOutside": "64" }, { - "id": "74", + "id": "b0", "name": "Eisfach", "tMax": -18 }, @@ -73,7 +73,7 @@ "name": "Aussen" }, { - "id": "9c", + "id": "38", "name": "Aussen 2" }, { @@ -88,5 +88,8 @@ "user": "admin", "pass": "admin", "database": "sensors" - } + }, + + "webport": 8081, + "apiport": 1900 } diff --git a/apps/lacrossegw.py b/apps/lacrossegw.py index d46b1e5..7348bf7 100755 --- a/apps/lacrossegw.py +++ b/apps/lacrossegw.py @@ -236,13 +236,14 @@ class Server(socketserver.ThreadingMixIn, socketserver.TCPServer): pass cache = {} - -server = Server(('0.0.0.0', 8080), MyHttpRequestHandler) +p = config["webport"] if "webport" in config else 8080 +server = Server(('0.0.0.0', p), MyHttpRequestHandler) server_thread = threading.Thread(target=server.serve_forever) server_thread.daemon = True server_thread.start() -apisrv = apiserver.ApiServer(1990) +p = config["apiport"] if "apiport" in config else 1990 +apisrv = apiserver.ApiServer(p) print("Waiting for sensors...")