mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-16 02:17:46 +01:00
Dynamically enable/disable cameras (#16894)
* config options * metrics * stop and restart ffmpeg processes * dispatcher * frontend websocket * buttons for testing * don't recreate log pipe * add/remove cam from birdseye when enabling/disabling * end all objects and send empty camera activity * enable/disable switch in ui * disable buttons when camera is disabled * use enabled_in_config for some frontend checks * tweaks * handle settings pane with disabled cameras * frontend tweaks * change to debug log * mqtt docs * tweak * ensure all ffmpeg processes are initially started * clean up * use zmq * remove camera metrics * remove camera metrics * tweaks * frontend tweaks
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
useEnabledState,
|
||||
useFrigateEvents,
|
||||
useInitialCameraState,
|
||||
useMotionActivity,
|
||||
@@ -15,6 +16,7 @@ import useSWR from "swr";
|
||||
import { getAttributeLabels } from "@/utils/iconUtil";
|
||||
|
||||
type useCameraActivityReturn = {
|
||||
enabled: boolean;
|
||||
activeTracking: boolean;
|
||||
activeMotion: boolean;
|
||||
objects: ObjectType[];
|
||||
@@ -56,6 +58,7 @@ export function useCameraActivity(
|
||||
[objects],
|
||||
);
|
||||
|
||||
const { payload: cameraEnabled } = useEnabledState(camera.name);
|
||||
const { payload: detectingMotion } = useMotionActivity(camera.name);
|
||||
const { payload: event } = useFrigateEvents();
|
||||
const updatedEvent = useDeepMemo(event);
|
||||
@@ -145,12 +148,17 @@ export function useCameraActivity(
|
||||
return cameras[camera.name].camera_fps == 0 && stats["service"].uptime > 60;
|
||||
}, [camera, stats]);
|
||||
|
||||
const isCameraEnabled = cameraEnabled === "ON";
|
||||
|
||||
return {
|
||||
activeTracking: hasActiveObjects,
|
||||
activeMotion: detectingMotion
|
||||
? detectingMotion === "ON"
|
||||
: updatedCameraState?.motion === true,
|
||||
objects,
|
||||
enabled: isCameraEnabled,
|
||||
activeTracking: isCameraEnabled ? hasActiveObjects : false,
|
||||
activeMotion: isCameraEnabled
|
||||
? detectingMotion
|
||||
? detectingMotion === "ON"
|
||||
: updatedCameraState?.motion === true
|
||||
: false,
|
||||
objects: isCameraEnabled ? objects : [],
|
||||
offline,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user