From 87d1a3c09cb2971445bda747723f76d25c565519 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Thu, 20 Mar 2025 09:21:37 -0600 Subject: [PATCH] Cleanup typing --- web/src/api/ws.tsx | 7 +++---- web/src/types/ws.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/web/src/api/ws.tsx b/web/src/api/ws.tsx index 27600993a..3e9c8c14f 100644 --- a/web/src/api/ws.tsx +++ b/web/src/api/ws.tsx @@ -44,7 +44,8 @@ function useValue(): useValueReturn { return; } - const cameraActivity: { [key: string]: object } = JSON.parse(activityValue); + const cameraActivity: { [key: string]: FrigateCameraState } = + JSON.parse(activityValue); if (Object.keys(cameraActivity).length === 0) { return; @@ -64,9 +65,7 @@ function useValue(): useValueReturn { autotracking, alerts, detections, - } = - // @ts-expect-error we know this is correct - state["config"]; + } = state["config"]; cameraStates[`${name}/recordings/state`] = record ? "ON" : "OFF"; cameraStates[`${name}/enabled/state`] = enabled ? "ON" : "OFF"; cameraStates[`${name}/detect/state`] = detect ? "ON" : "OFF"; diff --git a/web/src/types/ws.ts b/web/src/types/ws.ts index cdaee4def..3badd961d 100644 --- a/web/src/types/ws.ts +++ b/web/src/types/ws.ts @@ -54,6 +54,15 @@ export type ObjectType = { export interface FrigateCameraState { config: { enabled: boolean; + detect: boolean; + snapshots: boolean; + record: boolean; + audio: boolean; + notifications: boolean; + notifications_suspended: number; + autotracking: boolean; + alerts: boolean; + detections: boolean; }; motion: boolean; objects: ObjectType[];