From 1979672c62d996a70c64c34ceec6c4f8f1821db7 Mon Sep 17 00:00:00 2001 From: Untriex Programming Date: Wed, 17 Mar 2021 08:48:03 +0100 Subject: [PATCH] Update of server table --- server/main.py | 10 ++++------ server/settings.json | 9 ++++++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/server/main.py b/server/main.py index 9c6f979..1ec9f9c 100644 --- a/server/main.py +++ b/server/main.py @@ -12,6 +12,9 @@ import hashlib with open("settings.json", "r") as f: # loading settings settings = json.load(f) +with open("filesystem.json", "r") as f: # loading settings + filesystem = json.load(f) + IP = settings["IP"] ID = settings["ID"] location = settings["location"] @@ -25,11 +28,6 @@ time_to_heartbeat_offline = settings[ "time_to_heartbeat_offline"] # Raspberry will be requesting heartbeat every __ seconds from offline rpi # json variables -filesystem = { # Here will be files saved on this raspberry - "otvaracie_hod": ["t", {"pon": "10-25"}, {"uto": "10-25"}], - "prehliadka": ["pdf", "/files/prehliadka.pdf"], - "fotky_hrad": ["png_z", ["/files/hrad1.png", "/files/hrad2.png"]] -} heartbeat_table = settings["heartbeat_table"] sensors = { # List of "live" data like tempeature, etc. "teplota": 24, @@ -140,7 +138,7 @@ def comparision(file: str): @app.get("/devices_list") def get_devices_list(): - return heartbeat_table + return heartbeat_table["file_system"] def send_heartbeat(ip, id): diff --git a/server/settings.json b/server/settings.json index 989602e..ebf1394 100644 --- a/server/settings.json +++ b/server/settings.json @@ -12,5 +12,12 @@ "save_message": false, "print_message": true, "enable_debug": false - } + }, + "heartbeat_table": { + "ID": [], + "IP": [], + "location": [], + "file_system": [], + "last_heartbeat": [] +} }