Scripting versus chained triggers and actions

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Fri May 18, 2012 8:20 pm
nathanw offline
Posts: 153
Joined: Sep 05, 2011
Location: Boston, MA

Scripting versus chained triggers and actions

I just went through setting up a web-triggerable action for a dry kibble feeder for my cats. Here's what I ended up with:

- a "FeedNow" variable, set to True by the button on the control page.
- a trigger based on FeedNow changing to True, which checks if the feeder is already on and executes an action group if not
- an action group that turns on the ApplianceLinc, and uses the auto-off feature to turn it back off
- a trigger based on the ApplianceLinc turning off that resets FeedNow to False.

This feels awkward, and I don't like the fact that the logic is distributed across several places (variable, trigger, action) and a chain of different events. As a programmer, I'd much rather just embed a script in the action group and have it all in one place. In pseudocode, it's just:

Code: Select all
if device not on:
  turn device on
  wait two minutes
  turn device off

Is this logic that I can reasonably implement with the embedded Python scripting? I'm mostly concerned about the delay triggering some kind of watchdog timeout, but I'm also not sure if the device state changes will be reflected elsewhere (like the control page) if the script is still running.

Posted on
Sat May 19, 2012 8:40 am
jay (support) offline
Site Admin
User avatar
Posts: 18255
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Scripting versus chained triggers and actions

Embedded scripts do have a run limit. If you execute it as an external script there will be no limit since the script executes in it's own process. Device state changes will always be reflected in Indigo correctly this way also because the turn on/turn off commands are sent from the script's process to the server's process.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest