View unanswered posts | View active topics It is currently Tue May 21, 2013 11:03 am



Reply to topic  [ 4 posts ] 
 Two second delay from Security Script 
Author Message

Joined: Apr 01, 2003
Posts: 823
Location: Rio Rancho, NM
Post Two second delay from Security Script
I'm experiencing a 2 second delay from my security devices script that I can't figure out. It's consistent with the MS10As and Door/Window sensors. Here's an example log.

Code: Select all
2007-01-01 18:48:09   Received RF   security command sensor alert (max delay) (ID 43)
2007-01-01 18:48:09   Script   Security Device: Kitchen Motion Detector :sec_SensorAlert_max
2007-01-01 18:48:09   Script   SetMS10AState: Kitchen Motion Detector sent a alarm event
2007-01-01 18:48:11   Sent X10   "Kitchen Motion Detector" on


The security attachment script operates by changing the state of "fake" X10 devices in Indigo (I betting that one day Indigo will have them in the native UI). Here's the scripts I use:

-- Sample attachment script that illustrates how to listen to
-- commands from security devices. Only the W800RF32
-- interface receives these commands.030515 (mmb)

using terms from application "IndigoServer"
     on receive security event of eventType with code devID
          if devID is 9999 then
               log "Security Device: Garage Door"
               SetDoorState("Garage", eventType)
          else if devID is 87 then
               log "Security Device: Front Door"
               SetDoorState("Front Porch", eventType)
          else if devID is 169 then
               log "Security Device: Front Door"
               SetDoorState("Laundry Room", eventType)
          else if devID is 202 then
               log "Security Device: Small Bathroom :" & eventType
               SetDoorState("Small Bathroom", eventType)
          else if devID is 43 then
               log "Security Device: Kitchen Motion Detector :" & eventType
               SetMS10AState("Kitchen Motion Detector", eventType)
          else if devID is 2 then
               log "Security Device: Guest Bedroom Motion Detector :" & eventType
               SetMS10AState("Guest Bedroom Motion Detector", eventType)
          end if
     end receive security event
     
     
     on SetDoorState(DeviceName, theeventtype)
          set LongDeviceName to searchReplace(DeviceName, " ", "_")
          tell application "IndigoServer"
               if not (variable (LongDeviceName & "_Last_Open") exists) then make new variable with properties {name:(LongDeviceName & "_Last_Open"), value:((current date) as string)}
               if not (variable (LongDeviceName & "_Last_Closed") exists) then make new variable with properties {name:(LongDeviceName & "_Last_Closed"), value:((current date) as string)}
               if theeventtype is sec_SensorNormal_min and SubDate(value of variable (LongDeviceName & "_Last_Open")) is greater than SubDate(value of variable (LongDeviceName & "_Last_Closed")) then
                    set value of variable (LongDeviceName & "_Last_Closed") to (current date) as string
                    if (on state of device (DeviceName & " Door Sensor") is not false) then set on state of device (DeviceName & " Door Sensor") to false
                    log "SetDoorState: " & DeviceName & " is closed"
                    --logmessages("Door", (DeviceName & " Open"), false)
               else if theeventtype is sec_SensorAlert_min then
                    set value of variable (LongDeviceName & "_Last_Open") to (current date) as string
                    if (on state of device (DeviceName & " Door Sensor") is not true) then set on state of device (DeviceName & " Door Sensor") to true
                    log "SetDoorState: " & DeviceName & " is open"
                    --logmessages("Door", (DeviceName & " Open"), true)
               end if
          end tell
     end SetDoorState
     
     on SetMS10AState(DeviceName, theeventtype)
          
          if theeventtype is sec_SensorNormal_min or theeventtype is sec_SensorNormal_max then
               log "SetMS10AState: " & DeviceName & " sent a normal event"
          else if theeventtype is sec_SensorAlert_min or theeventtype is sec_SensorAlert_max then
               log "SetMS10AState: " & DeviceName & " sent a alarm event"
               set on state of device DeviceName to true
               set on state of device DeviceName to false
          end if
          
     end SetMS10AState
     
     
end using terms from


_________________
Greg In The Desert


Mon Jan 01, 2007 8:02 pm
Profile WWW
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11689
Location: Texas
Post Re: Two second delay from Security Script
Hi Greg,

I'm wondering if this is just the PowerLinc putting the X10 command on to the power line? If you take the interface offline (Interface->Offline menu item), then how quickly does the Send X10 line show in the Event Log? You could also watch the progress bar -- how quickly does the green nugget appear after the sensor is tripped. Indigo does not log the "Sent X10" line until after the PowerLinc reports back to Indigo that the command has successfully been put onto the power line.

Regards,
Matt


Tue Jan 02, 2007 9:12 am
Profile WWW

Joined: Apr 01, 2003
Posts: 823
Location: Rio Rancho, NM
Post 
Yes, I think this is the case. Any suggestions for changing the device state (and activate the triggers) without having indigo send a X10 command on the powerline?

_________________
Greg In The Desert


Tue Jan 02, 2007 12:13 pm
Profile WWW
Site Admin
User avatar

Joined: Jan 27, 2003
Posts: 11689
Location: Texas
Post 
gregjsmith wrote:Yes, I think this is the case. Any suggestions for changing the device state (and activate the triggers) without having indigo send a X10 command on the powerline?

I need to add an AppleScript mechanism to do this.

Matt


Tue Jan 02, 2007 12:57 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.