Alter Indigo delay values programmatically

Posted on
Sat Feb 22, 2020 3:20 pm
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Alter Indigo delay values programmatically

I'm using motions sensor occupancy to save energy in my house - turning off lights/etc. However, I'd like to have them adjustable based on the time of day. I recently switch to a Utility plan for my local energy provider with Time of Use (TOU), such that electric use costs more during peak hours but is very cheap at the off peak hours.

My energy saving implementation uses the Indigo settings for the Insteon Motion Sensors to 'set state to OFF' after a delay of XX minutes. My question is - can these Indigo settings for Insteon Motion sensors be altered programmatically so I can change them throughout the day? Basically, I'd set the 'delay value' to be small during the expensive times of TOU (aggressive energy saving).. and the 'delay value' would be large during the cheap TOU times (lazy energy saving)

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Thu Feb 27, 2020 12:22 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alter Indigo delay values programmatically

Can you explain/describe exactly what you're solution is currently doing? Be as specific as possible about the various parts.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 27, 2020 2:22 pm
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Alter Indigo delay values programmatically

The current solution 'works' - but it is basically using passive polling via scheduled jobs rather than a trigger... This is what I have:
- Indigo Variables for representing number of minutes of 'inactivity' before turning lights off.. Separate values which represent 'Peak Energy' (expensive) and 'Off Peak Energy' (cheap)
- Indigo Scheduled Jobs - set to wake up every 5 min or so - these jobs run scripts which compare motion sensor 'Last Changed' to the number of minutes specified by the Variables mentioned above.. If time is exceeded then the associated lights are turned off.
- Insteon Motion Sensors - these use 'Set State to Off' - I typically set these to be around 5 min (the smaller value closer to my Peak Energy (expensive) setting

Like I indicated - this is a bit passive and I'd like to get rid of the polling if possible. For example, based on the timing between the motion sensors turning OFF and my scheduled jobs running - I could potentially wait a worse case double the length of time.. I.e. if my Scheduled Job were set to run every 5 min.. and my motion sensor about 5 min as well - it could be close to 10 min in some occasions..

So - my request is that if I can programmatically change the Motion Sensor 'Set State to Off' based on time of day - essentially to a shorter amount of time for 'Peak Energy' and longer time for 'Off Peak Energy' - my implementation could switch to use more exact triggers - I could get rid of the less-precise scheduled job polling...

Hope this makes sense

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Posted on
Thu Feb 27, 2020 2:48 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Alter Indigo delay values programmatically

Why don't you use timers (Timers and Pesters plugin) to turn off the lights? There's an action to set the start time (amount of time to count down). So when the motion sensor is activated and you turn on the light, you could also start a timer with your current preferred timeout value.

You might be able to do it all with UI actions, or it might take a short Python script.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Feb 27, 2020 2:57 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alter Indigo delay values programmatically

I suppose I should have asked for your use-case instead... ;)

From what I'm reading, this is what you want: when Motion Sensor X goes off, wait Y minutes (configured to change throughout the day) then turn off a light.

If that's correct, how's this for a solution:

  1. Set your MSD to go off immediately when the module itself goes off.
  2. Create a timer for your Motion Sensor Device (MSD). Set it's run time to whatever time you want it to delay if it ran immediately.
  3. Create a trigger that sees the MS going OFF and restarts the timer (use restart action, not start action).
  4. Create a trigger that sees the MS going ON and the action cancels the timer
  5. Create a trigger using the Timers and Pesters Timer Expired Event, and make it's action to turn off the light.
  6. Create two schedules, one for each time during the day where the timeout period changes. The action will be to Set Timer Start Value to the new timeout period (i.e. 10 minutes or whatever)

So, any time the MS goes off, the trigger starts the timer running for however many minutes (or seconds or whatever) it's configured to run. When it expires, the light goes off. If, in the interim, if the motion sensor goes on/off, that's handled by the ON trigger and the fact that you use the timer restart action (which will restart it regardless of what state its in). The schedules set the timer's runtime so that during the day it's shorter, in the evening it's longer.

There are a variety of other ways to implement the solution that don't require polling, most involving scripts. Some will have fewer Indigo moving parts but will be more complex because the logic represented by each would have to be replicated in a script, so I chose to use the non-scripting solution.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 27, 2020 2:58 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Alter Indigo delay values programmatically

I see Joe replied while I was writing my reply - great minds think alike.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Thu Feb 27, 2020 3:03 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Alter Indigo delay values programmatically

jay (support) wrote:
I see Joe replied while I was writing my reply - great minds think alike.


But your answer was more complete. ;)

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Feb 27, 2020 7:20 pm
rbdubz3 offline
User avatar
Posts: 224
Joined: Sep 18, 2016
Location: San Diego, CA

Re: Alter Indigo delay values programmatically

Thanks for the detailed description of a solution to provide a more exacting and variable timing for turning off lights... I did think of this solution a while back, but was a bit averse to it due to the frequency of the motion sensors triggering on/off..

I'll give it a shot and see how it goes - thanks again

I automate because I am lazy :D - My Plugins: https://forums.indigodomo.com/viewforum.php?f=309

Page 1 of 1

Who is online

Users browsing this forum: Google [Bot] and 4 guests