View unanswered posts | View active topics It is currently Sat May 25, 2013 5:39 pm



Reply to topic  [ 2 posts ] 
 Scripting versus chained triggers and actions 
Author Message

Joined: Sep 05, 2011
Posts: 14
Post 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.


Fri May 18, 2012 8:20 pm
Profile
Site Admin
User avatar

Joined: Mar 19, 2008
Posts: 6667
Location: Austin, Texas
Post 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)
Image


Sat May 19, 2012 8:40 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: Google Feedfetcher 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.