Creating a schedule trigger... Issues

Posted on
Sat Dec 19, 2015 4:52 am
Chameleon offline
Posts: 611
Joined: Oct 04, 2014

Creating a schedule trigger... Issues

Hi all

Someone pointed out that Indigo can't launch a plugin from a trigger or a schedule and, after research, they're absolutely right! So that's one good idea out of the window :oops:

So as an alternative there are probably only two approaches to make this work.

The simplest would be to simply set a trigger to remind you to start the plugin on the morning of the 23rd December - email, sms, etc...

However there is an alternative but it's a bit involved:

    1. Run the plugin in test mode until it completes with Santa back at the North Pole and Resting. The plugin then goes into sleep mode waiting for you to disable it - but don't on this occasion!

    2. Update the Santa Tracker configuration and uncheck the two test options at the bottom of the configuration dialog (Plugins/Santa Tracker/Config...)

    3. Save the configuration

    4. Create a schedule trigger for 23rd December at 1am

    Screen Shot 2015-12-19 at 10.37.18.png
    Schedule trigger
    Screen Shot 2015-12-19 at 10.37.18.png (86.21 KiB) Viewed 562 times


    5. Now add an action that executes a script. On the Actions tab this is a Server Action>File and Script Action>Execute Script and add the following code as an embedded Python script:

    Code: Select all
    import indigo
    trackerId = "com.corporatechameleon.santaTrack" # supplied by the documentation
    trackerPlugin = indigo.server.getPlugin(trackerId)

    if trackerPlugin.isEnabled():
       trackerPlugin.restart(waitUntilDone=False)


    You should see something like this:

    Screen Shot 2015-12-19 at 10.39.32.png
    Restart code
    Screen Shot 2015-12-19 at 10.39.32.png (80.22 KiB) Viewed 562 times


    6. Now save the schedule trigger and wait until the 23rd December :D

    The important parts of these instructions are: a) You must leave the plugin in an enabled but sleeping state by running in test mode to the end and b) Don't forget to uncheck the Run in Test Mode and Run in Real Mode (and adjust Local Time to Calculated Start) before saving the configuration.

Of course, you can run the plugin in Real Mode right now and it will wait until the right time to start anyway (and you could put a cool countdown clock on your Control Page anyway). I don't think it will consume much processor power so I doubt that you'll even notice it's running :wink:

Regards

Mike

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest