Filename in Exec node

When a take a picture a function returns time/date. . The function return this output msg.filename : string[42] "/home/pi/Pictures/cam3_20220214-130253.jpg". In the Exec node, I currently have this settings -w 800 -h 600 -o ~/Pictures/test_image.jpg ....
I want to use this string withe the date/time as filename in Execl. I trided {{msg.filename}}, but with no success. Any suggestions?

What is the Raspistill node? I can't find it in the flows library.

Sorry for confusing ... it's the Exec node ... someone call it Raspistill, that's how it was mentioned as that ...

Can you show us a picture of the way your exec node is set up?

image

[{"id":"d4759f688d0bc9d7","type":"exec","z":"7e6eee155e9a533d","command":"raspistill","addpay":"","append":"-w 800 -h 600 -o ~/Pictures/test_image.jpg -a 4 -a 8","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":560,"y":220,"wires":[["7cd8371234d5ce41"],[],[]]},{"id":"2cb5db1dde091059","type":"template","z":"7e6eee155e9a533d","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<img width=\"800px\" height=\"600px\" src=\"data:image/jpg;base64,{{{payload}}}\">","output":"str","x":920,"y":220,"wires":[["63a819442e06474a"]]},{"id":"7cd8371234d5ce41","type":"base64","z":"7e6eee155e9a533d","name":"","action":"str","property":"payload","x":760,"y":220,"wires":[["2cb5db1dde091059"]]},{"id":"63a819442e06474a","type":"ui_template","z":"7e6eee155e9a533d","group":"c7a43587.2944e8","name":"","order":2,"width":"18","height":"15","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":false,"templateScope":"local","className":"","x":1080,"y":220,"wires":[["569d5ce9cd3f4d9c"]]},{"id":"cd0a94492fd443be","type":"inject","z":"7e6eee155e9a533d","name":"","props":[{"p":"payload"},{"p":"topic","v":"","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"num","x":190,"y":220,"wires":[["3a8571dfbade0c5b"]]},{"id":"3a8571dfbade0c5b","type":"function","z":"7e6eee155e9a533d","name":"","func":"var now = new Date();\n// Create formatted time\nvar yyyy = now.getFullYear();\nvar mm = now.getMonth() < 9 ? \"0\" + (now.getMonth() + 1) : (now.getMonth() + 1); // getMonth() is zero-based\nvar dd = now.getDate() < 10 ? \"0\" + now.getDate() : now.getDate();\nvar hh = now.getHours() < 10 ? \"0\" + now.getHours() : now.getHours();\nvar mmm = now.getMinutes() < 10 ? \"0\" + now.getMinutes() : now.getMinutes();\nvar ss = now.getSeconds() < 10 ? \"0\" + now.getSeconds() : now.getSeconds();\n\n\n// file path with / at the end\nvar path = \"/home/pi/Pictures/\"; // This is the path\nvar filename = \"cam3_\"+yyyy+mm+dd+\"-\"+hh+mm+ss+\".jpg\"; // file name\nmsg.filename = path + filename;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":220,"wires":[["d4759f688d0bc9d7"]]},{"id":"c7a43587.2944e8","type":"ui_group","name":"Default","tab":"fbd536a.22bf9c8","order":1,"disp":true,"width":"18","collapse":false,"className":""},{"id":"fbd536a.22bf9c8","type":"ui_tab","name":"Home","icon":"dashboard"}]

You could try setting msg.filename to -o /home/pi/Pictures/cam3_20220214-130253.jpg ie including the -o
And in the exec node tick Append. Change "payload" to "filename"

Error 126 .... i changed the function so now msg.filname is "-o ~/Pictures/cam3_20220214-140205.jpg". But still Error 126

Where is the error 126 coming from?Node-Red? Excel?
Is there more information than just 126?

Have you tried attaching a debug node (set to display the complete msg object) to each of the outputs of the exec node?

Node-Red ... Error 127.

2/14/2022, 2:47:51 PMnode: 44a171a32813c8acmsg.payload : Object
object code: 127

message: "Command failed: /home/pi/Pictures/raspistill -o ~/Pictures/cam3_20220214-140252.jpg -w 800 -h 600 -a 4 -a 8↵/bin/bash: line 1: /home/pi/Pictures/raspistill: No such file or directory↵"

What happens if you use the full path I.e. /home/pi/Pictures…

ohhhh ,,, full path ... Great!! Thanks you guys.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.