From 9fb8ad2c4b86ef7e103bd6aec2bce7b2a8e273fe Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Tue, 19 Dec 2023 10:57:17 +0800 Subject: [PATCH] fix: emit power-event on socket connect When initially loading the web-ui, the current state of the target needs to be transmitted as well. For that, we emit the power-event after connecting the websocket. Signed-off-by: Felix Moessbauer --- mtda/www.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mtda/www.py b/mtda/www.py index 76edffcb..723d525c 100644 --- a/mtda/www.py +++ b/mtda/www.py @@ -50,6 +50,9 @@ def connect(): data = mtda.console_dump() socket.emit("console-output", {"output": data}, namespace="/mtda") + power = mtda.target_status(session_id()) + socket.emit("power-event", {"event": power}, namespace="/mtda") + status, _, _ = mtda.storage_status(session_id()) socket.emit("storage-event", {"event": status}, namespace="/mtda")