Capture state of binary sensor into new sensor

I have a couple of Reolink cameras around my house. Since quite recent the Reolink integration also provides binary sensors for person detection. I have created a security dashboard including my camera feeds and alarm. Something that I’d like to include is the ‘triggers’ of the binary motion sensors via the logbook card. However, this card shows all the state changes of the binary sensor.

Instead of showing all these state changes I’d like to show on the triggers for when motion is detected, so effectively when the binary sensor changes to ‘on’. This would then give me a full overview of motion detected for a person.

My first thought was to include/exclude only a specific state in the logbook card, however I don’t see this possibility after having scanned also this forum.

My second thought is to create a new sensor that triggers a recording each time the binary sensor turns to ‘on’. Here however i’ve also been unsuccessful to find a way how to do this.

Hoping to find somebody here that can guide me into a direction of a working solution.

There’s a nice solution to catch the history of state changes:

Super, I managed to get it to work with the second link. Many thanks.

It can be done with a single Trigger-based Template Sensor; no custom integrations or additional entities are required.

The linked example also shows how to display the recorded data with a Markdown card.

Oups, I wanted to link to Taras’ example which is much cleaner.