The shell command ipcam_mp4 is creating a file called /config/temp/output.mp4
The whole automation works.
But If the automation runs two times simultaneously then I could have a race condition, and two files output.mp4 would be created at the same time, and I won’t know which one will be sent via Telegram.
What is the actual issue? is it that you may have and need 2 instances running almost simultaneously and therefore do need to differentiate the 2 files, or should you not have 2 automations running at the same time?
If latter, you can add a condition to your automation to check if it ran in the last xxx sec and make sure it doesn’t run again:
As the mp4 generation takes around 10 seconds, I don’t want to have something like :
trigger 1, starting to write file…
5 seconds after…
trigger 2, starting to write in the same file…
trigger 1 completes writing to the file - which is now corrupted
The ‘as_timestamp’ condition is genius and would fix my issue, I will add this for sure.
Your second solution is also very interesting, can we create variables in YAML using param: "{% set param = "blabla" %}{{var}}"
I didn’t see that documented anywhere. Did you use a custom component ?