Cleanup typing

This commit is contained in:
Nicolas Mowen 2025-03-20 09:21:37 -06:00
parent 709409b6c5
commit 87d1a3c09c
2 changed files with 12 additions and 4 deletions

View File

@ -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";

View File

@ -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[];