Dumb down NVR

got it working it was my fault. Thank you @rlkoshak @matt1 @Oliver2 @JimT for all the help pushing me to find a solution to my problem. I posted my solution by editing the original post.

Nice coding. I still do not understand where the advantage is (no offense - it is me who doesn‘t get it).
If you execute this command in a shell script it deletes files in a folder except the 20 newest ones:

ls -tp | tail -n +21 | xargs -I {} rm -- {}

If you execute this command, it returns the remaining 20 files sorted by time as an array which you can directly process in your rule:

ls $folder -1t

If you move your file operations to the level dealing with files (i.e. your OS) to my understanding you get a far more robust solution.
I tried to do the same because I wanted to have all my code in JS, but I stepped back from this approach as my code grew like yours😀

I you follow the tread the point of this is the wife everything you see is based on her feedback :slight_smile: . Not having to deal with another app and not having something complicated as a full fledged NVR.
Simple widget with simple navigation easy to explain. I will probably add options straight into the widget to adjust recording time deletion period etc so stay tuned.

Yes yes I first played with the exec binding before starting the route of importing nio.

Why only JavaScript well before this I did all my automations in dsl and then all of a sudden our alarm craped out and I have another one for testing from risco but needed a alarm so here started learning JavaScript. Now I am no expert in coding Linux etc my field has nothing to do with all this but I am trying and since I discovered openhab I liked it because it follows has alot of similarity with knx. Thinking about now I think Kai started this to have a visu and a way to automate stuff on his installation :slight_smile:

Please have a look at Frigate. It is simple to use, has a nice interface for looking up events and past history, and it deals with storage, cycling old snapshots, clips etc.

I started with blueiris and was resistant to change but so glad I made the change.

Frigate also offers nice Mqtt messages which make things easy to automate in openhab.

It can even send snapshots of events which you can save in an image item and display that on your sitemap.

Or you could perhaps just browse/expose its snapshot or clips folder?

2 Likes

The time I spent doing what I did now probably was just 5 minutes of spinning up a docker image and configuring an yaml file Wich I agree I get also object detection with Google coral etc.
But what about learning and also making other people happy ? Like for example trying to see what is the best way to remotely access openhab came as a necessity out of doing this myself and now I am looking into load balancer stuff so a fun little next project.

I only have 4 cameras and use NVIDIA GPU. Haven’t been able to buy a USB coral and the GPU seems fine.

By the way I’m curious to see your solution. Would you mind posting a screenshot?

Well in my case motion detectors are placed next to camera with a light so it’s very convenient to start recording based on that why process stream to see if I can find something.

Sure


1 Like

That looks pretty good!