XTension Discussion
Garage Door scripting
Enclosed is the Attachment's handler I use to manage the garage doors using
the wireless garage door sensors. These sensors were discussed on this last
fall. Over the winter I acquired the hardware which comprised of the
transmitters which mount on the garage doors and the transceiver which plugs
into the wall. The transceiver also appears to work with the palmpads which
is a nice feature. The garage door mounted transmitter/sensors detect when
the garage door orientation changes and sends the status change to the
transceiver which sends the update over the powerline. The interesting
information is an integer value (number) which conveys which of three garage
doors have opened or are open or have closed or are closed. The garage door
status is also sent over the powerline on a periodic basis so a dead battery
check could be written.
To integrate this handler into your XTension setup, you will need to paste
the applescript included below into your attachments window. Make sure you
don't already have a <<event xtenRxEv>> handler present in your attachments
or this won't work. If you do have this handler, you will need to integrate
my changes with yours.
As far as I know this will only work with a CM11A as it requires the
extended data for the garage door integer status value.
This script assumes you have defined up to three units for garage doors,
Garage Door 1, Garage Door 2 and Garage Door 3. The setting of the garage
door on/off or open/close is done with "no transmit". This allows you to
have universal modules with the same names and have the wireless sensors
update the units without creating an infinite loop (open/closing them
forever). Also the unit Garage Sensor is the transceiver itself. The
transceiver picks a unit code out of the air, as far as I can tell. You will
need to define the Garage Sensor unit with the unit code it chooses. You can
set the house code with the usual rotary dial. This may require that you
move a module that the transceiver steps on.
Let me know if you have any questions.
Greg
PS. The email delivery mechanism may line wrap some long lines. You will
need to unwrap them after you paste them into your attachments window.
PPS. Using this script creates an anomaly that was reported on this mailing
list quite some time ago. In my case the log report that XTension outputs to
the log window has the extended data wrong. This script continues to execute
properly but the log data value is messed up.
on «event xtenRxEv» of command given «class addr»:addr, «class tOvL»:tovl
set hc to character (addr div 256 - 47) of "ABCDEFGHIJ..........KLMNOP"
-- must have 10 'periods'
set uc to item (addr mod 256 - 47) of {"1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "", "", "", "", "", "", "", "11", "12", "13", "14",
"15", "16"}
--write log "Command: " & command & " Addr: " & addr & " " & hc & uc &
" tovl: " & tovl
if command is 8 then --extended data
if (hc & uc) is (unit address of "Garage Sensor") then
if tovl “ 64 then -- door 3
set gdoor to tovl - 64
else if tovl “ 32 then -- door 2
set gdoor to tovl - 32
else if tovl “ 16 then -- door 1
set gdoor to tovl - 16
end if
if gdoor mod 2 is 0 and (status of "Garage Door 1") then
turnoff "Garage Door 1" with no transmit
else if gdoor mod 2 is 1 and not (status of "Garage Door 1")
then
turnon "Garage Door 1" with no transmit
end if
if gdoor div 2 mod 2 is 0 and (status of "Garage Door 2") then
turnoff "Garage Door 2" with no transmit
else if gdoor div 2 mod 2 is 1 and not (status of "Garage Door
2") then
turnon "Garage Door 2" with no transmit
end if
if gdoor div 4 mod 2 is 0 and (status of "Garage Door 3") then
turnoff "Garage Door 3" with no transmit
else if gdoor div 4 mod 2 is 1 and not (status of "Garage Door
3") then
turnon "Garage Door 3" with no transmit
end if
end if
end if
continue «event xtenRxEv» of command given «class addr»:addr, «class
tOvL»:tovl
end «event xtenRxEv»
the wireless garage door sensors. These sensors were discussed on this last
fall. Over the winter I acquired the hardware which comprised of the
transmitters which mount on the garage doors and the transceiver which plugs
into the wall. The transceiver also appears to work with the palmpads which
is a nice feature. The garage door mounted transmitter/sensors detect when
the garage door orientation changes and sends the status change to the
transceiver which sends the update over the powerline. The interesting
information is an integer value (number) which conveys which of three garage
doors have opened or are open or have closed or are closed. The garage door
status is also sent over the powerline on a periodic basis so a dead battery
check could be written.
To integrate this handler into your XTension setup, you will need to paste
the applescript included below into your attachments window. Make sure you
don't already have a <<event xtenRxEv>> handler present in your attachments
or this won't work. If you do have this handler, you will need to integrate
my changes with yours.
As far as I know this will only work with a CM11A as it requires the
extended data for the garage door integer status value.
This script assumes you have defined up to three units for garage doors,
Garage Door 1, Garage Door 2 and Garage Door 3. The setting of the garage
door on/off or open/close is done with "no transmit". This allows you to
have universal modules with the same names and have the wireless sensors
update the units without creating an infinite loop (open/closing them
forever). Also the unit Garage Sensor is the transceiver itself. The
transceiver picks a unit code out of the air, as far as I can tell. You will
need to define the Garage Sensor unit with the unit code it chooses. You can
set the house code with the usual rotary dial. This may require that you
move a module that the transceiver steps on.
Let me know if you have any questions.
Greg
PS. The email delivery mechanism may line wrap some long lines. You will
need to unwrap them after you paste them into your attachments window.
PPS. Using this script creates an anomaly that was reported on this mailing
list quite some time ago. In my case the log report that XTension outputs to
the log window has the extended data wrong. This script continues to execute
properly but the log data value is messed up.
on «event xtenRxEv» of command given «class addr»:addr, «class tOvL»:tovl
set hc to character (addr div 256 - 47) of "ABCDEFGHIJ..........KLMNOP"
-- must have 10 'periods'
set uc to item (addr mod 256 - 47) of {"1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "", "", "", "", "", "", "", "11", "12", "13", "14",
"15", "16"}
--write log "Command: " & command & " Addr: " & addr & " " & hc & uc &
" tovl: " & tovl
if command is 8 then --extended data
if (hc & uc) is (unit address of "Garage Sensor") then
if tovl “ 64 then -- door 3
set gdoor to tovl - 64
else if tovl “ 32 then -- door 2
set gdoor to tovl - 32
else if tovl “ 16 then -- door 1
set gdoor to tovl - 16
end if
if gdoor mod 2 is 0 and (status of "Garage Door 1") then
turnoff "Garage Door 1" with no transmit
else if gdoor mod 2 is 1 and not (status of "Garage Door 1")
then
turnon "Garage Door 1" with no transmit
end if
if gdoor div 2 mod 2 is 0 and (status of "Garage Door 2") then
turnoff "Garage Door 2" with no transmit
else if gdoor div 2 mod 2 is 1 and not (status of "Garage Door
2") then
turnon "Garage Door 2" with no transmit
end if
if gdoor div 4 mod 2 is 0 and (status of "Garage Door 3") then
turnoff "Garage Door 3" with no transmit
else if gdoor div 4 mod 2 is 1 and not (status of "Garage Door
3") then
turnon "Garage Door 3" with no transmit
end if
end if
end if
continue «event xtenRxEv» of command given «class addr»:addr, «class
tOvL»:tovl
end «event xtenRxEv»
Next message in thread
Thread
Re: Garage Door scripting
/ "Greg Satz" <satz-AT-iranger.com>
/ 24 Apr 2000
Re: Garage Door scripting
/ "Hendrik W. M. van Eeden" <hvaneeden-AT-home.com>
/ 24 Apr 2000
Re: Garage Door scripting
/ "Bruce Lawton" <bruce-AT-alwaysthinking.com>
/ 24 Apr 2000
Re: Garage Door scripting
/ <michael-AT-shed.com>
/ 24 Apr 2000
Re: Garage Door scripting
/ "Bruce Lawton" <bruce-AT-alwaysthinking.com>
/ 25 Apr 2000
