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 {