From 393579a7a4f46f9c32c4bb11fa4053f2c167097f Mon Sep 17 00:00:00 2001 From: derlole <122916573+derlole@users.noreply.github.com> Date: Wed, 7 May 2025 11:41:53 +0000 Subject: [PATCH] test 5 --- modules/socketio.py | 2 +- static/socketio.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/socketio.py b/modules/socketio.py index c789c62..c6f5759 100644 --- a/modules/socketio.py +++ b/modules/socketio.py @@ -6,7 +6,7 @@ from datetime import datetime socketio = SocketIO(cors_allowed_origins="*", async_mode='threading') - +# function to change the datetime format to isoformat because json does not support datetime def convert_datetimes(obj): if isinstance(obj, dict): return {k: convert_datetimes(v) for k, v in obj.items()} diff --git a/static/socketio.js b/static/socketio.js index 33cff4d..0c60348 100644 --- a/static/socketio.js +++ b/static/socketio.js @@ -5,10 +5,16 @@ function gebId(id) { const socket = io(); socket.on('static_data', (data) => { + console.log(data); + console.log("1"); gebId("beans-fill").innerText = data.beans.fill + "%" gebId("water-fill").innerText = data.water.fill + "%" gebId("beans-filled").innerText = data.beans.refilled gebId("water-filled").innerText = data.water.refilled + gebId("ip_global").innerText = data.esp_conn_infos.ip_global + gebId("ip_local").innerText = data.esp_conn_infos.ip_local + gebId("valid_connection").innerText = data.esp_conn_infos.connection_valid + gebId("last_seen").innerText = data.esp_conn_infos.last_seen if (data.water.fill < 20) { gebId("water-fill").parentElement.classList.add("blink-orange"); }else {