mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-07-26 13:47:03 +02:00
Ensure camera always have config object updated
This commit is contained in:
parent
4db2a98b0b
commit
709409b6c5
@ -306,7 +306,6 @@ class CameraState:
|
||||
# TODO: can i switch to looking this up and only changing when an event ends?
|
||||
# maintain best objects
|
||||
camera_activity: dict[str, list[any]] = {
|
||||
"enabled": True,
|
||||
"motion": len(motion_boxes) > 0,
|
||||
"objects": [],
|
||||
}
|
||||
|
@ -164,8 +164,12 @@ class Dispatcher:
|
||||
|
||||
def handle_on_connect():
|
||||
camera_status = self.camera_activity.last_camera_activity.copy()
|
||||
cameras_with_status = camera_status.keys()
|
||||
|
||||
for camera in self.config.cameras.keys():
|
||||
if camera not in cameras_with_status:
|
||||
camera_status[camera] = {}
|
||||
|
||||
for camera in camera_status.keys():
|
||||
camera_status[camera]["config"] = {
|
||||
"detect": self.config.cameras[camera].detect.enabled,
|
||||
"enabled": self.config.cameras[camera].enabled,
|
||||
|
@ -174,7 +174,7 @@ export function useEnabledState(camera: string): {
|
||||
value: { payload },
|
||||
send,
|
||||
} = useWs(`${camera}/enabled/state`, `${camera}/enabled/set`);
|
||||
return { payload: (payload ?? "ON") as ToggleableSetting, send };
|
||||
return { payload: payload as ToggleableSetting, send };
|
||||
}
|
||||
|
||||
export function useDetectState(camera: string): {
|
||||
|
@ -91,21 +91,13 @@ export default function LivePlayer({
|
||||
// camera activity
|
||||
|
||||
const {
|
||||
enabled: cameraWasEnabled,
|
||||
enabled: cameraEnabled,
|
||||
activeMotion,
|
||||
activeTracking,
|
||||
objects,
|
||||
offline,
|
||||
} = useCameraActivity(cameraConfig);
|
||||
|
||||
const cameraEnabled = useMemo(() => {
|
||||
if (!cameraWasEnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return cameraConfig.enabled;
|
||||
}, [cameraConfig, cameraWasEnabled]);
|
||||
|
||||
const cameraActive = useMemo(
|
||||
() =>
|
||||
!showStillWithoutActivity ||
|
||||
@ -393,7 +385,10 @@ export default function LivePlayer({
|
||||
<div
|
||||
className={cn(
|
||||
"absolute inset-0 w-full",
|
||||
showStillWithoutActivity && !liveReady && !isReEnabling
|
||||
showStillWithoutActivity &&
|
||||
!liveReady &&
|
||||
!isReEnabling &&
|
||||
cameraEnabled
|
||||
? "visible"
|
||||
: "invisible",
|
||||
)}
|
||||
|
@ -52,7 +52,9 @@ export type ObjectType = {
|
||||
};
|
||||
|
||||
export interface FrigateCameraState {
|
||||
enabled: boolean;
|
||||
config: {
|
||||
enabled: boolean;
|
||||
};
|
||||
motion: boolean;
|
||||
objects: ObjectType[];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user