1. Keep the door locked when we aren't around to use it.

    For this, we just use a timer.  When the timer reaches 1, the door is locked.  This wasn't this easy with the X10 solution because there was no way to know the Universal Module receive the command and locked the door.  Here is what the timer event looks like:

    If Timer, Garage Lock Is GE Now 60
    Then Sw, Door, Garage Lock Set Open
    If Timer, Garage Lock Is Now 1
    Then Sw, Door, Garage Lock Set Closed

  2. Close the garage door after no activity has been detected in the garage for 20 minutes.

    There are a couple of pieces to perform this.  For starters, Mary has to know if someone is in the garage.  We use motion detectors to detect warm bodies, each of which sets a timer.  There are a couple of timers and items involved in detecting and tracking which motion detector active.  Rather than try and describe it, here is the way it looks:

    ;----------------------------------------------------------------
    ; The first motion detector timer to control the state of the
    ; motion detector item.
    ;----------------------------------------------------------------
    If Timer, Garage 1 Is GE 1
    Then Motion, Garage 1 Set On        ->Item for tracking motion on Detector 1
    Else Motion, Garage 1 Set Off
    ;----------------------------------------------------------------
    ; The second motion detector timer to control the state of the
    ; motion detector item.
    ;----------------------------------------------------------------
    If Timer, Garage 2 Is GE 1
    Then Motion, Garage 2 Set On        ->Item for tracking motion on Detector 2
    Else Motion, Garage 2 Set Off
    ;----------------------------------------------------------------
    ; We will watch both motion detectors to determine motion status
    ; in the garage. If we motion ceases, we will attempt to close
    ; the garage door.
    ;----------------------------------------------------------------
    If Motion, Garage 1 Is On
    Or Motion, Garage 2 Is On
    Then Motion, Garage Set True
    Else Motion, Garage Set False
    If Motion, Garage Is Now False
    Then Event-Call Set Garage Close
    ;----------------------------------------------------------------
    ; And finally the control for the lights related to the group
    ; timer.
    ;----------------------------------------------------------------
    If Timer, Garage Is Now 1
    Then Rm, Garage Set 0
    Then Event-Call Set Rm, Garage
    If Timer, Garage Is GT Now 300
    Then Rm, Garage Set 1
    Then Event-Call Set Rm, Garage

  3. When departing the house, Mary opens the garage door, waits 5 seconds (after the door is open), closes the door, then waits for another 90 seconds (after the door is closed) and turns all the inside lights off.

    This is fairly simple with all the called events we described prior to building this event.  First we send a command via a button press on a remote (keychain remote in this case).  This sets an exit timer if there is sign of life in the house (and only if there is sign of life for security purposes).  Here is how the timer event works:

    If Timer, Exit Is 0                    ->Ignore this event if timer is already at 0
    Then Event-Exit Set True
    If Timer, Exit Is Now 180              ->Start at 180 seconds
    Then Event-Call Set Garage Open        ->Open the door (This event listed elsewhere)
    If Timer, Exit Is Now 160              ->Takes about 15 seconds to open the door + about 5 pause seconds
    Then Event-Call Set Garage Close       ->Close the door (This event listed elsewhere)
    If Timer, Exit Is Now 90               ->Wait about another minute
    Then Set, Timers, All Set 5            ->Set all the timers to 5 seconds so all the
    Then Event-Call Set Set, Timers, All   ->lights in the house will turn off