HI
Hoping someone can advise if this can be done and if so how
I have folder /local/share/camera which stores my motion detected videos from my camera’s and notifies me of new file all works well.
I would like to have a method (that will continue to work with updates ect) that would allow me grab the latest file from the folder above , then copy and rename it to /config/www/camera/latest.mp4 then to show with camera.local_file in the UI (showing file is all good from with www but not outside).
I could change my setup to have the camera folder with www but that would get backed up with snapshots which I don’t want
mv $(ls -t1 /local/share/camera/*.mp4|head -n1) /config/www/camera/latest.mp4
ls -t1 /local/share/camera/*.mp4 #lists all the files with extension mp4 in the /usr/localshare/camera directory in date order (latest at top)
head -n1 # takes just the first line of that listing
wrapping that in $( ) writes that result as part of tha command line.
mv # moves the file to your desireld destination.
Please test carefully, mv is destructive. Perhaps use cp while testing, as a copy is non destructive.
Tested via ssh command line and works well
But when i add the shell command and test it using services nothing appears to happen. So go to look at logs and HA locks up ??
any ideas, what am i missing
Thanks will test and all good I appreciate the help
It is white listed as all works from commas line and I can record from the camera to either directory
But will try quotes
@Kelvin_Sudlow sorry for bumping an old thread, but did you ever find a viable solution for this? I’m trying to do something similar - but have been unsuccessful thus far.
Interesting! How to you execute this and where did you put your code?
Ideally I would like to trigger this when my camera detects motion, upload it via FTP to the /share folder and then x seconds later I would like to move it to the /www folder and let me view the clip in Lovelace.
sorry for bumping an old thread like this, but can i copy or move that file into another HomeAssistant with ssh? or maybe there is another way to do it?
alrght thanks then i will learn about scp cause i need to make automation VSC backup from my client Homeassistant into my server home assistant. but can u give me a little explain abt SCP or a little example maybe to use scp for copy file from homeassistant to another?