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:
Nicolas Mowen
2024-05-26 16:49:12 -05:00
committed by GitHub
parent 63d81bef45
commit c2eac10925
10 changed files with 151 additions and 117 deletions
+21
View File
@@ -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,
};
}