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?
|
# TODO: can i switch to looking this up and only changing when an event ends?
|
||||||
# maintain best objects
|
# maintain best objects
|
||||||
camera_activity: dict[str, list[any]] = {
|
camera_activity: dict[str, list[any]] = {
|
||||||
"enabled": True,
|
|
||||||
"motion": len(motion_boxes) > 0,
|
"motion": len(motion_boxes) > 0,
|
||||||
"objects": [],
|
"objects": [],
|
||||||
}
|
}
|
||||||
|
@ -164,8 +164,12 @@ class Dispatcher:
|
|||||||
|
|
||||||
def handle_on_connect():
|
def handle_on_connect():
|
||||||
camera_status = self.camera_activity.last_camera_activity.copy()
|
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"] = {
|
camera_status[camera]["config"] = {
|
||||||
"detect": self.config.cameras[camera].detect.enabled,
|
"detect": self.config.cameras[camera].detect.enabled,
|
||||||
"enabled": self.config.cameras[camera].enabled,
|
"enabled": self.config.cameras[camera].enabled,
|
||||||
|
@ -174,7 +174,7 @@ export function useEnabledState(camera: string): {
|
|||||||
value: { payload },
|
value: { payload },
|
||||||
send,
|
send,
|
||||||
} = useWs(`${camera}/enabled/state`, `${camera}/enabled/set`);
|
} = 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): {
|
export function useDetectState(camera: string): {
|
||||||
|
@ -91,21 +91,13 @@ export default function LivePlayer({
|
|||||||
// camera activity
|
// camera activity
|
||||||
|
|
||||||
const {
|
const {
|
||||||
enabled: cameraWasEnabled,
|
enabled: cameraEnabled,
|
||||||
activeMotion,
|
activeMotion,
|
||||||
activeTracking,
|
activeTracking,
|
||||||
objects,
|
objects,
|
||||||
offline,
|
offline,
|
||||||
} = useCameraActivity(cameraConfig);
|
} = useCameraActivity(cameraConfig);
|
||||||
|
|
||||||
const cameraEnabled = useMemo(() => {
|
|
||||||
if (!cameraWasEnabled) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cameraConfig.enabled;
|
|
||||||
}, [cameraConfig, cameraWasEnabled]);
|
|
||||||
|
|
||||||
const cameraActive = useMemo(
|
const cameraActive = useMemo(
|
||||||
() =>
|
() =>
|
||||||
!showStillWithoutActivity ||
|
!showStillWithoutActivity ||
|
||||||
@ -393,7 +385,10 @@ export default function LivePlayer({
|
|||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
"absolute inset-0 w-full",
|
"absolute inset-0 w-full",
|
||||||
showStillWithoutActivity && !liveReady && !isReEnabling
|
showStillWithoutActivity &&
|
||||||
|
!liveReady &&
|
||||||
|
!isReEnabling &&
|
||||||
|
cameraEnabled
|
||||||
? "visible"
|
? "visible"
|
||||||
: "invisible",
|
: "invisible",
|
||||||
)}
|
)}
|
||||||
|
@ -52,7 +52,9 @@ export type ObjectType = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export interface FrigateCameraState {
|
export interface FrigateCameraState {
|
||||||
enabled: boolean;
|
config: {
|
||||||
|
enabled: boolean;
|
||||||
|
};
|
||||||
motion: boolean;
|
motion: boolean;
|
||||||
objects: ObjectType[];
|
objects: ObjectType[];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user