Display camera snapshots on dashboard

Upon a camera detecting a person, I want to capture a camera snapshot and be able to view that camera snapshot on the dashboard. I understand I can do this with an automation and display the snapshot on a picture entity card. That part is not too difficult.

The tricky bit is I want to have display 5 picture entity cards on a dashboard, with the picture entity cards showing the 5 most recent camera snapshots where persons were detected. Effectively every time a new person is detected and a new camera snapshot is taken, the oldest of the 5 camera snapshots is deleted and the new one appears. I’d also like the snapshots to be automatically ordered by chronology.

Any ideas of how best to do this as I am a bit baffled?

THANKS!

just name them snapshot1, snapshot2, etc. then use shell_command to rm snapshot5.jpg and rename the rest (mv snapshot4.jpg snapshot5.jpg) each time…

or, if u like to keep an archive of all of the snapshots such that u don’t want to delete any, then use 5 helpers like input_text.snapshot1, and have them point to the right snapshot file, and update those each time.

thanks - but how would I code the logic so that i rename them? Not sure how to do that.