Article about two button remotes and XTension:

I have a simple problem.  I live on 10 acres in a rural setting, with my son, 
his wife, and their four children.  There are 6 major buildings, 1000 feet of 
driveways, and lots of periodic activity in several areas.

The property is heavily wooded, so with the exception of the driveway and 
parking for shipping and visitors, there are few locations which have a clear 
view for as much as 50 feet.

Anyone who has ever moved from the city to the sticks has found that it is a 
completely different psychological setting.  It doesn't take long to adapt to 
the new strange noises, and soon you can recognize a car turning in to your 
driveway over a thousand feet away, just by the vibrations.

When unusual noises occur, I immediately want to know whether I'm alone 
on the property.  If everyone bothered to call and tell me that they were 
going out, I would simply know to go and investigate.  But people forget, and 
not knowing causes a gumption trap.

So, I would like to know at any time the system detects an alarm condition 
in my son's house, that it's a real alarm, and I should investigate. Further, 
the system should alert me, wherever I am.

Likewise, if I am gone, and my son's house is not empty.  When everybody is 
off property of course, other scripts should take care of dialing a neighbor, or 
the alarm service, or sending me a page.


So we began by deciding to use two wireless 2-button transmitters, one 
carried by me, and the other at my son's house near the door at his house ( 
or carried by him ).  We chose the device for it's size, and because we had 
used them before with good results.

The two-buttons on the device each have two functions, īsend ON' and īsend 
OFF' for each of two X-10 addresses.  You must select a single house code, 
and one device gets units 1 & 2 while the other gets units 5 & 6.

Next, we placed a wireless receiver in each of the major buildings so that we 
could enter any building at will.

There are two wireless transmitter/receiver products manufactured by X-
10.  One includes a receiver which can accept only ON and OFF commands 
from any of 16 unit code buttons on any wireless remote.  The other includes 
a receiver which can deal with only 8 devices, but has Dim and Bright 
controls.    

Both of the receivers with work with the large wireless transmitters, but 
only the 16 address base unit will work with the 2-button wireless for units 
5 & 6.  We chose the 16 address base units which were both smaller and less 
expensive.

Of course these were meant originally to turn on or off any of two X-10 
devices directly, but with XTension, we can split up the ONs and OFFs into 
separate functions, giving us at least 8 simple functions with two 2-button 
wireless transmitters.

So we began by listing the various conditions that could exist with the 
comings and goings of the two major houses.  After carefully thinking about 
it, we came up with the following 'states' which would be controlled by our 
two keychain remotes.

        *  Michael is in his house.
        *  Michael is in his office.
        *  Michael is in the Lab.
        *  Michael is Gone
        *  Paul is in his house.
        *  Paul is in his office or Lab.
        *  Paul is Gone.
        *  Paul is house is empty.
 
We can live for now with these simple states, in that those who live in my 
son's house can easily remember to punch the button that says their house is 
empty, or that someone's home when they return.  A secret is to get the kids 
involved!

Now let's try to describe what we had to do with the X-10 units and how we 
configured XTension.

First you set the two wireless keychain devices to your choice of housecodes.  
Both must be set to the same housecode, but one must be set to units 1 & 2, 
the other must be set to units 5 & 6.  

Next we placed the wireless receiver modules in each of the 6 buildings at or 
near its main entrance.

Then we created the appropriate items in the XTension database :

Set up 4 units in the database with addresses x1, x2, x5 & x6, where x is 
your choice of house codes.

Give them these names :  (substitute your own initials...)

		x1 = MF home or office
		x2 = MF lab or gone
		x5 = PF home or office
		x6 = PF gone or empty

For each of these units you must create scripts for both the ON and the OFF 
states :

	* MF home or office ON :
		turnon "MF at home"

	* MF home or office OFF :
		turnon "MF in office"

	* MF lab or gone ON :
		turnon "MF in lab"

	*  MF lab or gone OFF :
		turnon "MF is gone"

	*  PF home or office ON :
		turnon "PF at home"

	*  PF home or office OFF :
		turnon "PF in office"

	*  PF gone or empty ON :
		turnon "PF is gone"

	*  PF gone or empty OFF :
		turnon "PF house is empty"

Note that you shouldn't ītest' these scripts until you have created the next 
group of units : 

Create the 8 units called for in the previous scripts, and give them the 
following ON scripts :

	MF at home
	if status of "Daylight" is false then
  	    turnon "House Walk Lights"
 	    turnoff "House Walk Lights" in 5 * minutes
	end if

	block unit "All Alarms"
	unblock unit "MF House Alarms"
	write log "MF is in his house"

	MF in office
	if status of "Daylight" is false then
	    turnon "Office Walk Lights"
	    turnoff "Office Walk Lights" in 5 * minutes
	end if

	block unit "All Alarms"
	unblock unit "Office Alarms"
	write log "MF is in his office"

	MF in lab
	if status of "Daylight" is false then
  	    turnon "Lab Walk Lights"
  	    turnoff "Lab Walk Lights" in 5 * minutes
	end if

	block unit "All Alarms"
	unblock unit "Lab Alarms"
	write log "MF is in the lab"

	MF is gone
	if status of "PF house empty" is true then
  	    unblock unit "All Alarms"
	else
  	    block unit "All Alarms"
  	    unblock unit "PF House Alarms"
	end if

	write log "MF is off the property"

	PF at home
	if status of "MF is Gone" is true then
  	    unblock unit "PF House Alarms"
  	    if status of "All Alarms" is true then
  	        tell application "Alert User" of machine "Paul's Home"
	            write log "Alarms have occurred while you were out "
 	            beep 10         -- beep 10 times
	        end tell
	  end if  
	end if

	write log "PF is at home"

	PF in office
	if status of "Daylight" is false then
  	    turnon "Front Walk Lights"
  	    turnoff "Front Walk Lights in 5 * minutes
	end if

	unblock unit "PF office alarms"
	write log "PF is in his office"

	PF is gone
	if status of "MF is Gone" is true then
  	    unblock unit "All Alarms"
	end if
	write log "PF is off property"

	PF house is empty
	if status of "MF is Gone" is true then
  	    unblock unit "All Alarms"
	else
 	    if status of "MF in House" is true then
   	        tell app "Alert User" of machine "Michael"
      	            write log "Paul's house is now empty"
     	             beep 3
    	        end tell
  	    end if

  	    if status of "MF in Office" is true then
   	        tell app "Alert User" of machine "Office"
       	            write log "Paul's house is now empty"
        		beep 3
   	        end tell
  	    end if

 	    if status of "MF in Lab" is true then
    	         tell app "Alert User" of machine "Lab"
       	             write log "Paul's house is now empty"
        	             beep 3       -- OR 'speak' ...?
    	         end tell
	    end if
	end if


Now, whenever I move to a different location, I tell the system where I am 
going.  If it is night time, lights turn on to guide me to my destination. 

If I hear noises near my son's house, I know that there's nobody home and I 
should take a look at the XTension activity log.  If an sensor triggers 
somewhere, I get the alarm wherever I am, rather than bothering the 
neighbors with yelping sirens.  Likewise, anyone in my son's house gets 
notified of any exceptions which occur in my house when I am gone. 

The kids have gotten involved and help the parents remember to push the 
right button on coming and going.  

Of course we are working on a 4-button wireless wall-mount switch which 
will be able to keep track of each of the children as they check in or out of 
the house.

You might even consider keeping track of more people, like in a small office, 
it's much easier than writing your name on a board when you come or go.  
With XTension and AppleScript, there is no limit to what you can link this 
information into  !

Another direct analogy of this application in the world of the handicapped.  
Knowing where and when caretakers come and go, and avoiding unnecessary 
alarms, can bring a lot of independence and reassurance.

Please be advised that all of the above scripts are stripped-down examples 
of what our real scripts include, for obvious reasons.  I have some interesting 
scripts which work with other Macintosh add-on products such as the YoYo 
and QuickCam, but that would be food for another article...