How to program a switch to come on for 10 min(toilet fan)

Does any know how to program a switch to stay on for example 10 min using the same switch as the trigger ? Example going in to the bathroom turning on the fan switch and it stays on for 10 min using that same switch as the trigger .

I have 2 toilets at home.
I have used Program Logic Event Generator to start/stop the fan.
In my case the light(s) must be on for 3min. before the fan starts.
After that it stopt after 10min.

Triggers

Name Description
Toi_1_LightOn Toilet1Light is turned on
Toi_2_LightOn Toilet2Light is turned on

Conditions

Fan_H Toi_1_LightOn or Toi_2_LightOn
Timer_F_H Fan_H and (Fan_H; NOW > 00:03:00 < 00:20:00)
Fan_L (Timer_F_H; NOW > 00:10:00)

Actions
Actions for Condition: Fan_L
Immediate
Device Action Arguments
BoxFan_High SetTarget newTargetValue=0

Actions for Condition: Timer_F_H
Immediate
Device Action Arguments
BoxFan_High SetTarget newTargetValue=1

I’m new in this so I would need a little more info where to enter that, I’m using micasa light

Ok, from the start:

First you have to install “Program Logic” and “Program Logic Event Generator” and “Program Logic Timer Switch” under the ‘apps’ tab.
If you have done that you can use my suggestion.

I am a senoir newby, and I have to learn a lot too. But I found out that with these apps you can do a lot.
First it can be hard to understand how it works, but step by step you will find your way.

For tonight I don’t have any time, but tommorow I have. ;D

While PLEG is an excellent tool and its power is demonstrated in the above conditional logic, it is still possible to have the requested 10 minute turn off with a stock Vera Lite scene.

You’ll need to create a scene that uses the light switch as a trigger. You’ll use a delay(look at the “Immediate” drop down) for your action(turn off).

Turning On switch on triggers the scene. The scene uses a 10 minute delay before issuing the Off command.