Capture state of binary sensor into new sensor

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.