NVR with realtime local object detection for IP cameras
TypeScript aicameragoogle-coralhome-assistanthome-automationhomeautomationmqttnvrobject-detectionrealtimertsptensorflow
Quick fix (#16926)
Nicolas Mowen56079d080dbd
diff --git a/frigate/object_processing.py b/frigate/object_processing.pyindex 783c2b2d03..a7a2fb066c 100644--- a/frigate/object_processing.py+++ b/frigate/object_processing.py@@ -707,16 +707,14 @@ class TrackedObjectProcessor(threading.Thread):def _get_enabled_state(self, camera: str) -> bool:_, config_data = self.enabled_subscribers[camera].check_for_update()+if config_data:- enabled = config_data.enabled+ self.config.cameras[camera].enabled = config_data.enabled+if self.camera_states[camera].prev_enabled is None:- self.camera_states[camera].prev_enabled = enabled- return enabled- return (- self.camera_states[camera].prev_enabled- if self.camera_states[camera].prev_enabled is not None- else self.config.cameras[camera].enabled- )+ self.camera_states[camera].prev_enabled = config_data.enabled++ return self.config.cameras[camera].enableddef run(self):while not self.stop_event.is_set():diff --git a/web/src/api/ws.tsx b/web/src/api/ws.tsxindex 27600993ad..5eedcdbcda 100644--- a/web/src/api/ws.tsx+++ b/web/src/api/ws.tsx@@ -174,7 +174,7 @@ export function useEnabledState(camera: string): {value: { payload },send,} = useWs(`${camera}/enabled/state`, `${camera}/enabled/set`);- return { payload: payload as ToggleableSetting, send };+ return { payload: (payload ?? "ON") as ToggleableSetting, send };}export function useDetectState(camera: string): {diff --git a/web/src/components/player/LivePlayer.tsx b/web/src/components/player/LivePlayer.tsxindex 913373774e..ae9fd61970 100644--- a/web/src/components/player/LivePlayer.tsx+++ b/web/src/components/player/LivePlayer.tsx@@ -203,6 +203,9 @@ export default function LivePlayer({const prevCameraEnabledRef = useRef(cameraEnabled ?? true);useEffect(() => {+ if (cameraEnabled == undefined) {+ return;+ }if (!prevCameraEnabledRef.current && cameraEnabled) {// Camera enabledsetLiveReady(false);diff --git a/web/src/hooks/use-camera-activity.ts b/web/src/hooks/use-camera-activity.tsindex 14a5752248..28eb8c67df 100644--- a/web/src/hooks/use-camera-activity.ts+++ b/web/src/hooks/use-camera-activity.ts@@ -16,7 +16,7 @@ import useSWR from "swr";import { getAttributeLabels } from "@/utils/iconUtil";type useCameraActivityReturn = {- enabled: boolean;+ enabled?: boolean;activeTracking: boolean;activeMotion: boolean;objects: ObjectType[];@@ -148,7 +148,7 @@ export function useCameraActivity(return cameras[camera.name].camera_fps == 0 && stats["service"].uptime > 60;}, [camera, stats]);- const isCameraEnabled = cameraEnabled === "ON";+ const isCameraEnabled = cameraEnabled ? cameraEnabled === "ON" : undefined;return {enabled: isCameraEnabled,