My goal is to create a scene for my ventilation fans in my 3 bathrooms. One scene would be for toilet use, start scene and shut off 15 minutes later. A shower scene. Start shower scene, shut off fan 25 minutes later. A bath scene, start scene, shut fan off 60 minutes later. I would make separate scene for the different events. I have a Vera 3 and VeraPlus controller.
With the countdown timer, you might not need to write any lua code at all. See http://forum.micasaverde.com/index.php?topic=9425.0.
Also, check out PLEG: http://forum.micasaverde.com/index.php/board,48.0.html
I agree PLEG makes this much easier to set up.
I recommend a z-wave light switch on the light and fan (if separate) with a humidity sensor somewhere in the bathroom - perhaps wired into the fan. In this way, when someone turns on the light, the fan would not turn on until the humidity level reaches some level you choose, and the fan stays on until the humidity level drops to a level you choose.
That level could be a number you determine, or, better yet, a comparison to the humidity level in other parts of the house. PLEG makes it real easy to compare the bathroom humidity to the house humidity and trigger the fan on and off.
This could work even if someone showers in the dark (except Vera would turn on the light if it is a single fan/light combo).