Two things worthy of mention here:
There are several places this occurs and we will just talk about two. Since there are several PCs throughout the house, we want to be able to turn off the lights in a room we know there isn't anybody in (assuming we just left that area). ECS has a really nice to use web interface so we can control just about anything just like we were sitting in front of Mary. On one of the group screens, there is a button defined that calls an event to turn off all the lights defined downstairs. This is one of the benefits of having written cascading events so we don't have to explicitly call every light downstairs we want to turn off. For this example, I will trace the event through every level down to the command that turns off one of the downstairs lights. We will start with the button press from the web interface group screen:
If Icon-Click1 Is Lite Dn
Then Set, Grp, Down Set 0
->Set a variable (Item Type: Number)
Then Grp, Downstairs Set 0
->Turn off all the lights downstairs (Item Type: Number)
Then Event-Call Set Set, Grp, Down
->Call the event to reset the timers to zero
Then Event-Call Set Grp, Downstairs
->Call the event to turn off the lights
We won't follow the hierchy of the timers but suffice it to say the same
sort of thing happens. We called the event 'Grp, Downstairs' so lets
go look at it:
Then Area, Theater Set Grp, Downstairs
->Each variable carries the state of the
Then Area, Office Set Grp, Downstairs
->area it will be responsible for.
Then Area, Garage Set Grp, Downstairs
Then Event-Call Set Area, Theater
->Each event here controls an area.
Then Event-Call Set Area, Office
Then Event-Call Set Area, Garage
We are going to follow the main theater lights and we know those must be in
the theater area so lets have a look at that event:
Then Rm, Theater Set Area, Theater
->Now we break each area down into rooms
Then Rm, Hall, Down Set Area, Theater
->for both the variable...
Then Rm, Bath, Down Set Area, Theater
Then Rm, Laundry Set Area, Theater
Then Event-Call Set Rm, Theater
->... and for the event.
Then Event-Call Set Rm, Hall, Down
Then Event-Call Set Rm, Bath, Down
Then Event-Call Set Rm, Laundry
The theater lights must be in the Rm, Theater so lets go look at that event:
Then St, Theater Set Rm, Theater
->Then we go down to the light level and
Then St, Rec Room Set Rm, Theater
->the same thing happens for the variable...
Then Event-Call Set Lt, Theater
->... and for the event. Then we go to each
Then Event-Call Set Lt, Rec Room
->event for every light.
Here we had a little trouble since we already had an item with the name Lt,
Theater (that was obviously the case for all the lights) so we have an item
that holds the state we want to test in the event Lt, Theater. This is
also quite a bit longer since there are many states this light can respond
to. Here is the event:
If St, Theater Is 0
->The first three levels are standard across all the
Then Lt, Theater Set Off
->incandescent lights (0,1, and 6)
If St, Theater Is 1
Then Lt, Theater Set On
If St, Theater Is 6
Then Lt, Theater Set 61%
;
If St, Theater Is 103
->There are a couple of lights that require some
Then Lt, Theater Set 3%
->levels for the purposes of slowly incrementing the
If St, Theater Is 106
->level until the light is turned on completely; this
Then Lt, Theater Set 6%
->is one light that requires such abilities. The
If St, Theater Is 110
->application is explained in Sunrise
Simulation.
Then Lt, Theater Set 10%
If St, Theater Is 113
Then Lt, Theater Set 13%
If St, Theater Is 116
Then Lt, Theater Set 16%
If St, Theater Is 119
Then Lt, Theater Set 19%
If St, Theater Is 123
Then Lt, Theater Set 23%
If St, Theater Is 126
Then Lt, Theater Set 26%
If St, Theater Is 129
Then Lt, Theater Set 29%
If St, Theater Is 132
Then Lt, Theater Set 32%
If St, Theater Is 135
Then Lt, Theater Set 35%
If St, Theater Is 139
Then Lt, Theater Set 39%
If St, Theater Is 142
Then Lt, Theater Set 42%
If St, Theater Is 145
Then Lt, Theater Set 45%
If St, Theater Is 148
Then Lt, Theater Set 48%
If St, Theater Is 152
Then Lt, Theater Set 52%
If St, Theater Is 155
Then Lt, Theater Set 55%
If St, Theater Is 158
Then Lt, Theater Set 58%
If St, Theater Is 161
Then Lt, Theater Set 61%
If St, Theater Is 165
Then Lt, Theater Set 65%
If St, Theater Is 200
Then Lt, Theater Set On
There are a couple of times we don't want the office lights to turn on. First of all, the door to our office enters in the middle of the room. In order to cover the entire office with one motion detector, it has to point down the hall. At the other end of the hall is the theater which is reason number one. The office is very visible to the theater and during movies we only want light from the theater lights and the TV.
The second reason is I work at home and need to keep the lights on during the day. There are times I don't move around a lot so the timer will expire and all the lights will turn off. The fix for this is to set the office timer for around 9 hours and disable the motion detector (or keep it from setting the timer associated with it).
The fix for challenge number one is simple. We do something similar with the theater lights with a movie timer which we describe in Theater. When this movie timer is set to anything greater than zero, the motion control for the office is turned off. If it is set to zero (or counted down to zero), it is turned back on. This is only performed upon the state change so we can control it elsewhere. It looks like this:
If Timer, Movie Is Now 0
Then Motion Ctl, Office Set On
If Timer, Movie Is GT Now 0
Then Motion Ctl, Office Set Off
After experimenting, I came up with the following icon click event for
working at home that answers number two:
BEGINIF Icon-Click1 Is 9 Hours
->9 hours is the name of the icon
If Motion Ctl, Office Is On
->We wanted a toggle so it could be
Then Motion Ctl, Office Set Off
->controlled by one button both ways
Then Timer, Office Set 32400
->Set the timer for 9 hours
Then Rm, Office Set 1
->Turn on all the office lights
Then Event-Call Set Rm, Office
Then St, Ofc, Ovhd, Pam Set 6
->Change the state of the lights not over
Then St, Ofc, Lamp, Pam Set 0
->my desk since I am the only one at home.
Then St, Ofc, Ovhd, Ctr Set 6
Then Event-Call Set Lt, Ofc, Ovhd, Pam
->Call the events to execute the above
Then Event-Call Set Lt, Ofc, Lamp, Pam
->changes.
Then Event-Call Set Lt, Ofc, Ovhd, Ctr
Else If Motion Ctl, Office Is Off
Then Motion Ctl, Office Set On
->In case we want to change back to motion
Then Rm, Office Set 1
->control on; turn all the office lights
Then Event-Call Set Rm, Office
->on and set the timer for 120 seconds so
Then Timer, Office Set 120
->the lights will turn back off if no
ENDIF
->movement is detected in 2 minutes.
There is one more way motion control can be turned back on and that is by
Sign of Life changing to false. An example of this can be found
in section 3 of Sign of Life on the Inside
Lights page.