Condition if sensor has been on during the last x minutes then true

Hi Forum,

Possibly a simple question, but I want an automation where the condition should be that if a sensor has been on during the last X minutes it should be true, else false. How do I write a condition for that?
I don’t think that a “For” will be the solution since it has to see over a whole period whether it has been switched on at some point.

Cheer, Rasmus

The for criteria means “Has the entity’s state been ‘on’ continuously over the last X minutes”.

If you want your condition to be “Has the entity’s state been ‘on’ at any time in the last X minutes” that will require other approaches.

Is the automation triggered by the same sensor you want the condition based on?
Is there more than one trigger for the automation?