From 265d68752edb413aa36f25a9b3b6ad0546f3789b Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 24 Sep 2024 07:23:14 -0500 Subject: [PATCH] description websocket hook and dispatcher --- frigate/comms/dispatcher.py | 4 ++++ web/src/api/ws.tsx | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/frigate/comms/dispatcher.py b/frigate/comms/dispatcher.py index 3d8628dfe..b55707ab5 100644 --- a/frigate/comms/dispatcher.py +++ b/frigate/comms/dispatcher.py @@ -140,6 +140,10 @@ class Dispatcher: event: Event = Event.get(Event.id == payload["id"]) event.data["description"] = payload["description"] event.save() + self.publish( + "event_update", + json.dumps({"id": event.id, "description": event.data["description"]}), + ) elif topic == "onConnect": camera_status = self.camera_activity.copy() diff --git a/web/src/api/ws.tsx b/web/src/api/ws.tsx index 94f381ada..79d2bd3b4 100644 --- a/web/src/api/ws.tsx +++ b/web/src/api/ws.tsx @@ -321,3 +321,10 @@ export function useImproveContrast(camera: string): { ); return { payload: payload as ToggleableSetting, send }; } + +export function useEventUpdate(): { payload: string } { + const { + value: { payload }, + } = useWs("event_update", ""); + return useDeepMemo(JSON.parse(payload as string)); +}