diff --git a/frigate/api/camera.py b/frigate/api/camera.py index 1c03a5b7aa..1881bde6d3 100644 --- a/frigate/api/camera.py +++ b/frigate/api/camera.py @@ -1224,6 +1224,15 @@ def camera_set( status_code=400, ) + if not sub_command and feature in _SUB_COMMAND_FEATURES: + return JSONResponse( + content={ + "success": False, + "message": f"Feature '{feature}' requires a sub-command (e.g. mask or zone name)", + }, + status_code=400, + ) + if camera_name == "*": cameras = list(frigate_config.cameras.keys()) elif camera_name not in frigate_config.cameras: diff --git a/frigate/comms/dispatcher.py b/frigate/comms/dispatcher.py index 4eeb763961..27d5ef1255 100644 --- a/frigate/comms/dispatcher.py +++ b/frigate/comms/dispatcher.py @@ -118,10 +118,21 @@ class Dispatcher: try: if command_type == "set": + # Commands that require a sub-command (mask/zone name) + sub_command_required = { + "motion_mask", + "object_mask", + "zone", + } if sub_command: self._camera_settings_handlers[command]( camera_name, sub_command, payload ) + elif command in sub_command_required: + logger.error( + "Command %s requires a sub-command (mask/zone name)", + command, + ) else: self._camera_settings_handlers[command](camera_name, payload) elif command_type == "ptz":