Detect switch on/off/on in PLEG

I am trying to set up a PLEG action triggered by a light switch that is turned on/off/on in a relatively short time.

-Whenever the on/off/on sequence is activated, start or restart a timer (nominal expiration 30 mins), then Start Garage Fan, turn off after 3 minutes
-If the door opens when this timer is activated, then Start Garage Fan, turn off after 3 minutes

I would appreciate any comments on my configuration, and tips on how to modify the trigger so that the timer is activated by on/off/on, rather than just when turned on.

Triggers

Name Description State Last True Last False
Door Whenever Zone #15 - Garage Do detects motion whether is armed or disarmed true 2018-03-25 18:19:24.230 0
lightoff Whenever the Garage Counter is turned off false 2018-03-25 18:09:32.303 2018-03-25 18:15:42.233
lighton Whenever the Garage Counter is turned on true 2018-03-25 18:15:42.233 2018-03-25 18:09:32.302
Conditions

Name Options Logic Expression Value Last True (or Last Change) Last False (or Previous Change)
Activated (lighton; lightoff; lighton) false 2018-03-25 16:47:41.906 2018-03-25 18:09:23.131
Gofan (Activated and Door) false 0 0
Actions

Name When Defined Actions
Activated Condition is True Immediate - 1; Delay 10 - 1; Delay 45:00 - 0
Gofan Condition is True Immediate - 1; Delay 03:00 - 1
Action: Activated

Device Actions:

Immediate

Device Action Arguments
Garage Fan 0318[267] SetTarget newTargetValue=1
Delay 10

Device Action Arguments
Garage Fan 0318[267] SetTarget newTargetValue=0
Delay 45:00

Device Action Arguments
Action: Gofan

Device Actions:

Immediate

Device Action Arguments
Garage Fan 0318[267] SetTarget newTargetValue=1
Delay 03:00

Device Action Arguments
Garage Fan 0318[267] SetTarget newTargetValue=0
Referenced Devices

Name Type
Zone #15 - Garage Do[229] MotionSensor1
Garage Counter[266] BinaryLight1
Garage Fan 0318[267] BinaryLight1
PLEG Test - Gar Fan[284] ProgramLogicEG

Edit: clarity

Try it as a sequence.

tSwitchOn
tSwitchOff

cMomentaryOn [font=verdana]tSwitchOn;[/font][font=verdana]tSwitchOff;[/font][font=verdana]tSwitchOn[/font]

tSwitchOn;tSwitchOff;tSwitchOn

That won’t work.
The last tSwitchOn time can’t be both before and after the last tSwitchOff time.

You want to look at the multi count operator:
tSwitchOn @ 2 < 15

The above says if tSwitchOn was turned on twice in the last 15 seconds.

How about:-?

tSwitchOn1
tSwitchOn2
tSwitchOff

cMomentaryOn tSwitchOn1;tSwitchOff;tSwitchOn2