mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-06 06:42:51 +03:00
Disabled cameras fixing (#17273)
* Fix case where objects are returned as null * Fix enabled status not being persisted * Use config as source of truth when refreshed * Ensure camera always have config object updated * Cleanup typing
This commit is contained in:
@@ -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,
|
||||
|
||||
+3
-1
@@ -113,8 +113,10 @@ def capture_frames(
|
||||
def get_enabled_state():
|
||||
"""Fetch the latest enabled state from ZMQ."""
|
||||
_, config_data = config_subscriber.check_for_update()
|
||||
|
||||
if config_data:
|
||||
return config_data.enabled
|
||||
config.enabled = config_data.enabled
|
||||
|
||||
return config.enabled
|
||||
|
||||
while not stop_event.is_set():
|
||||
|
||||
Reference in New Issue
Block a user