View unanswered posts | View active topics It is currently Wed Jun 19, 2013 6:32 am



Reply to topic  [ 3 posts ] 
 Indigo Server 4.1.1 hanging 
Author Message

Joined: Nov 26, 2006
Posts: 13
Post Indigo Server 4.1.1 hanging
I have some Time/Date Action scripts running my Halloween lighting automation, and after several hours, Indigo Server stops responding and the computer eventually becomes completely non-responsive. I can't even force quit any of the open applications. My only recourse is to do a hard reboot of the computer.

I have one scripts which randomly triggers itself every 1-3 seconds and another one which triggers itself every 1-7 seconds. Both use Apple Script for control. I've included them below for you to see.

Any ideas? Anything else you'd like me to provide?

Thanks,
John

========== Halloween Strobe Script ===================
set theDevice to "Living Room lamp in turret"
set theSceneIndex to 99 -- Halloween strobe
set theTrigger to "Halloween Strobe"
set plist to "Halloween" -- must be the name of THIS trigger
set rnd to false
set theEffectsFolder to ((path to home folder) & "Music:Sound Effects:lightning") as string

tell application "IndigoServer"
    with transaction
        transaction suppress logging
        if on state of device theDevice is false then
            send insteon group instnTurnOn using index theSceneIndex
            set randomTime to (random number from 1 to 2) --turn off after 1 to 2 seconds
            delay 0.25
            tell application "QuickTime Player" -- play a sound effect using QuickTime
                tell application "Finder"
                    set theEffect to some item of folder theEffectsFolder as string --must use "as string" or file will open from Finder in iTunes
                end tell
                try
                    stop front document
                    close front document
                end try
                open theEffect
                rewind front document
                play front document
            end tell
        else
            send insteon group instnTurnOff using index theSceneIndex
            set randomTime to (random number from 3 to 7) --turn on every 3 to 7 seconds
        end if
    end transaction
end tell

set tempTriggerTime to (current date) + (randomTime)
set absolute trigger time of time date action theTrigger to tempTriggerTime
========== End Halloween Strobe Script ================

========== Halloween House Lights Script ===============
set theTrigger to "Halloween House Lights" -- must be the name of THIS trigger.
set theDevice to "Front Door Foryer" -- any device that is in the scene

set theSceneIndexBrighten to (random number from 102 to 102) -- Halloween BRIGHTEN Scenes in PowerLinc
set theSceneIndexDim to (random number from 103 to 103) -- Halloween DIM Scenes in PowerLinc

tell application "IndigoServer"
    with transaction
        transaction suppress logging
        if brightness of device theDevice < 25 then
            send insteon group instnTurnOn using index theSceneIndexBrighten
            set randomTime to (random number from 1 to 3)
        else
            send insteon group instnTurnOn using index theSceneIndexDim -- Use instnTurnOn when using separate Dim Scenes
            set randomTime to (random number from 1 to 3)
        end if
    end transaction
end tell

-- set next trigger
set tempTriggerTime to (current date) + (randomTime)
set absolute trigger time of time date action theTrigger to tempTriggerTime
========== End Halloween House Lights Script ============


Mon Oct 26, 2009 11:55 pm
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6848
Location: Austin, Texas
Post Re: Indigo Server 4.1.1 hanging
greennote wrote:I have some Time/Date Action scripts running my Halloween lighting automation, and after several hours, Indigo Server stops responding and the computer eventually becomes completely non-responsive. I can't even force quit any of the open applications. My only recourse is to do a hard reboot of the computer.

I have one scripts which randomly triggers itself every 1-3 seconds and another one which triggers itself every 1-7 seconds. Both use Apple Script for control. I've included them below for you to see.

Any ideas? Anything else you'd like me to provide?


Ok - it appears that you're running these embedded since they have the following line outside the tell to "IndigoServer":

Code: Select all
set absolute trigger time of time date action theTrigger to tempTriggerTime


That means that you're creating an AppleScript transaction inside the main thread of the IndigoServer and, in the case of the first app, talking to external apps without any timeouts and error handling. This is generally a bad thing to do. Embedded AppleScripts must run on the main thread of the IndigoServer - so if something goes wrong in the script and you don't catch it - Indigo hangs up. Putting stuff inside a transaction grouping with no timeout and error catching is also potentially a problem even if it doesn't communicate with an external app.

So, the first thing you'll want to do is make these scripts external scripts so that they're launched as separate processes from Indigo - that may not stop the hangup, but it's certainly one very obvious potential. Also - you might consider putting all the logic in a stay-open AppleScript that just does random delays between executions rather than have a time/date action kick them off - that would cut down on the AppleScript process startup time, etc., and more fully encapsulate your functionality in one place. When you're talking about scheduling repeating events on the order of seconds apart, it's probably easier to just think about it inside the context of the AppleScript (IMHO).

_________________
Jay (Indigo Support)
Image


Tue Oct 27, 2009 7:53 am
Profile WWW

Joined: Nov 26, 2006
Posts: 13
Post 
Thanks, Jay. I'll give your suggestions a try and see what happens. Will let you know if I still get hangups.

By the way, love the "spook potential" Indigo is giving me for Halloween.

Happy Halloween!


Tue Oct 27, 2009 8:52 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.   Template designed by STSoftware.