Setting template variable to persist throughout automation actions

I have a need for the following:

Trigger on door opening
Record from camera.
Delay 10s to allow recording.
Send pushbullet notification which includes camera recording.

The issue is that I need the pushbullet action to be templated based on the state of a sensor before the 10s delay. Is there any way to use a template variable to save that sensor’s state, then delay, then access that template variable in a later action? My understanding was that template variables are local to the template they are in.

I can think of a few workarounds involving creating separate scripts that are called by the automation but wanted to ask if there was an easier way to do this.

How about starting recording and storing the state in an input_text?
Btw, what sensor? :wink:

Your suggestion was my other workaround - but using hass-variable (from HACS).

The sensor is a PIR sensor inside the door that wells me if the door opening is someone arriving or departing.

It’s your choice after all but why using something non-standard if there is a perfect standard one?
Especially if you are not interested in things like surviving HA restart etc. It just works.
We can call it workaround or whatever but with Jinja no global variables is a reality so I’d call it “a standard way of doing” this sort of things.

Actually, why not doing anything within a python_script?
Store and keep whatever you want.