mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-08-01 08:32:18 +03:00
Tweaks and fixes (#11541)
* Update config version to be stored inside of the config * Don't remove items from list when navigating back * Use video api instead of webps for live current hour filmstrip * Check that the config file is writable * Show camera name when camera is offline * Show camera name when offline * Cleanup
This commit is contained in:
@@ -10,11 +10,13 @@ import { useTimelineUtils } from "./use-timeline-utils";
|
||||
import { ObjectType } from "@/types/ws";
|
||||
import useDeepMemo from "./use-deep-memo";
|
||||
import { isEqual } from "lodash";
|
||||
import { useAutoFrigateStats } from "./use-stats";
|
||||
|
||||
type useCameraActivityReturn = {
|
||||
activeTracking: boolean;
|
||||
activeMotion: boolean;
|
||||
objects: ObjectType[];
|
||||
offline: boolean;
|
||||
};
|
||||
|
||||
export function useCameraActivity(
|
||||
@@ -116,12 +118,31 @@ export function useCameraActivity(
|
||||
handleSetObjects(newObjects);
|
||||
}, [camera, updatedEvent, objects, handleSetObjects]);
|
||||
|
||||
// determine if camera is offline
|
||||
|
||||
const stats = useAutoFrigateStats();
|
||||
|
||||
const offline = useMemo(() => {
|
||||
if (!stats) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const cameras = stats["cameras"];
|
||||
|
||||
if (!cameras) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return cameras[camera.name].camera_fps == 0;
|
||||
}, [camera, stats]);
|
||||
|
||||
return {
|
||||
activeTracking: hasActiveObjects,
|
||||
activeMotion: detectingMotion
|
||||
? detectingMotion === "ON"
|
||||
: initialCameraState?.motion === true,
|
||||
objects,
|
||||
offline,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user