Use double switching as a trigger

Is there any way that I could get phrased a trigger that was turning on a switch twice for perform another action?
Like if I turned on the lights in the living room two times in a row (on - off - on) within 2-3 seconds I would trigger another action?
I feel like it should be doable, but I can’t wrap my head around how I would accomplish this!
And that is where you get in to the picture, great community :wink:
Any bright ideas out there??

Should be doable with a template sensor. If the sensor turns true use it as a trigger.

I have no idea how to do that. Never quite figured templates out. Can you elaborate a bit? Maybe show an example?

I’ve been trying to figure out how i would archive this, but i really don’t understand how a custom template works. Is there anyone here, that could give me an example i could build on?