Trigger only the first time of the day, during a time range?

Posted on
Wed May 03, 2017 9:34 am
blysik offline
Posts: 213
Joined: Jan 06, 2015

Trigger only the first time of the day, during a time range?

I want to trigger an action between a time range, but only if it's the first time a certain device changes that day. Is there a good way to do this in native Indigo?

Thanks!

Posted on
Wed May 03, 2017 10:02 am
jay (support) offline
Site Admin
User avatar
Posts: 18216
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Trigger only the first time of the day, during a time ra

Here's one way:

  1. Create a variable (triggerShouldExecute or something) to indicate if the trigger should run, set it to true.
  2. Create your trigger with the time range as one condition and a check to see if the variable is true as a second condition. The actions are to run whatever actions you want and to set the variable to false (to indicate that you've already run it).
  3. Create a schedule that runs at midnight and resets the variable to true.

You can probably skip that last step if it's a small time range - you could add another action to the trigger that would set the variable back to true and with a delay that would guarantee that the time range would be over. So, if your time range is a 3 hour window, then delay the action to set the variable to true by 3 hours and you'd be all set.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests