From c1f07505269f4df662314c9b395a3e5b18ec99ac Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Fri, 15 Jan 2021 22:01:24 -0600 Subject: [PATCH] ensure each camera has a detect role set --- frigate/config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frigate/config.py b/frigate/config.py index eb2b47869..0595d6191 100644 --- a/frigate/config.py +++ b/frigate/config.py @@ -146,6 +146,12 @@ def each_role_used_once(inputs): raise ValueError return inputs +def detect_is_required(inputs): + roles = [role for i in inputs for role in i['roles']] + if not 'detect' in roles: + raise ValueError + return inputs + CAMERA_FFMPEG_SCHEMA = vol.Schema( { vol.Required('inputs'): vol.All([{ @@ -154,7 +160,8 @@ CAMERA_FFMPEG_SCHEMA = vol.Schema( 'global_args': vol.Any(str, [str]), 'hwaccel_args': vol.Any(str, [str]), 'input_args': vol.Any(str, [str]), - }], vol.Msg(each_role_used_once, msg="Each input role may only be used once")), + }], vol.Msg(each_role_used_once, msg="Each input role may only be used once"), + vol.Msg(detect_is_required, msg="The detect role is required")), 'output_args': { vol.Optional('detect', default=DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT): vol.Any(str, [str]), vol.Optional('record', default=RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT): vol.Any(str, [str]),