Action for something that did not happen as scheduled

Posted on
Fri Jul 15, 2016 6:39 pm
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Action for something that did not happen as scheduled

I have a vibration sensor on a home backup electricity generator. The generator is scheduled to run every week on Saturday morning at 10AM. When it runs, a trigger goes off and sends me an email that the generator had run. How can I create an action which will send me an email if it did NOT run?

John R Patrick
Author of
Home Attitude

Posted on
Fri Jul 15, 2016 7:44 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Action for something that did not happen as scheduled

In your trigger, add an action that updates a variable with a timestamp of the execution; then create a schedule that runs whenever you want - it could check the variable and if it is not within a day/hour/whatever you choose then send you a notification that it didn't run.

Posted on
Sat Jul 16, 2016 8:10 am
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Action for something that did not happen as scheduled

Thank you very much. I get the logic, but not exactly how to execute it. I created the trigger and puts the timestamp into my variable, generatorStatus. Then I created a schedule to run weekly. It can compare the variable to more than or less than something but how do I specify that the something is say 7 days + 2 hours?

John R Patrick
Author of
Home Attitude

Posted on
Sat Jul 16, 2016 8:13 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Action for something that did not happen as scheduled

Don't compare the value of the variable - compare the LastUpdated timestamp.

(I'm assuming that is exposed in the UI to compare against; that's what Adam is suggesting!)


Sent from my iPhone using Tapatalk

Posted on
Sat Jul 16, 2016 8:18 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Action for something that did not happen as scheduled

(Actually, I think he's storing the timestamp into the variable - not using the lastUpdated property - then comparing if that is more than x seconds/minutes/hours etc)


Sent from my iPhone using Tapatalk

Posted on
Sat Jul 16, 2016 8:36 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Action for something that did not happen as scheduled

Don't bother using a timestamp. Set the "generatorDidRun" variable to True in the action that sends the email. Then create a schedule that runs a couple hours after the generator is supposed to run. If the variable is False, send the did not run email. Then another schedule that runs a minute later that sets the variable back to False. No timestamps!

Or if you're up for a little Python scripting, do the test and send email in a script, and then reset the variable. Then you only need one schedule.

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

Posted on
Sat Jul 16, 2016 8:44 am
howartp offline
Posts: 4559
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Action for something that did not happen as scheduled

Good call - I like that one :-)


Sent from my iPhone using Tapatalk

Posted on
Sat Jul 16, 2016 8:45 am
Colorado4Wheeler offline
User avatar
Posts: 2794
Joined: Jul 20, 2009
Location: Colorado

Re: Action for something that did not happen as scheduled

If you don't want to do any coding, here is a thought:

  1. Use the built-in method to store the date/time into a variable each time you send your email, you know this is a fixed number of days/hours/minutes etc so if it's over that you know the genny didn't run
  2. You can utilize my Device Extensions and a conversion extension to "Convert Date/Time to Elapsed Minutes", this will always give you a state of how many minutes between the stored date in the variable and now
  3. Create a trigger that says "if elapsed minutes is more than 1 week" then something is wrong

That requires no coding and seems to me might work for what you want.

I do this same thing on a much smaller level (and why I created that particular extension) with a motion sensor that sometimes goes offline, it tells me how many minutes since it's last check in (I do that using the device property and not a variable but the idea is the same) and if it's over a certain number then I act.

My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here

Posted on
Sat Jul 16, 2016 9:50 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Action for something that did not happen as scheduled

FlyingDiver wrote:
Don't bother using a timestamp. Set the "generatorDidRun" variable to True in the action that sends the email. Then create a schedule that runs a couple hours after the generator is supposed to run. If the variable is False, send the did not run email. Then another schedule that runs a minute later that sets the variable back to False. No timestamps!


I like this one. You don't need another schedule however, just add another action to set the variable back to False and delay it by 5 minutes.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jul 16, 2016 9:55 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Action for something that did not happen as scheduled

jay (support) wrote:
I like this one. You don't need another schedule however, just add another action to set the variable back to False and delay it by 5 minutes.


But if there's a condition on the schedule to only execute if the variable to False, then it won't run the delayed action, would it?

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

Posted on
Sat Jul 16, 2016 10:12 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Action for something that did not happen as scheduled

FlyingDiver wrote:
jay (support) wrote:
I like this one. You don't need another schedule however, just add another action to set the variable back to False and delay it by 5 minutes.


But if there's a condition on the schedule to only execute if the variable to False, then it won't run the delayed action, would it?


Sorry, I wasn't clear. You don't need the 3rd schedule, you can just have the first trigger (that set it to True) also set it back to False, but delay that action until after the schedule (that checks the variable and sends the negative case email) executes.

So, to be clear (I'm using made-up times here, you'll have to see what works best for you):

  • Trigger that fires when the generator successfully runs has 3 actions: send the positive case email, set the variable to True, set the variable to False after 10 minutes
  • Schedule that runs at 10:05, with a condition that the variable is False, send the negative email

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jul 16, 2016 10:16 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Action for something that did not happen as scheduled

jay (support) wrote:
Sorry, I wasn't clear. You don't need the 3rd schedule, you can just have the first trigger (that set it to True) also set it back to False, but delay that action until after the schedule (that checks the variable and sends the negative case email) executes.


Oh, I see what you mean. A delayed action on the vibration trigger that resets the flag AFTER the scheduled check runs. Depending on how accurate the auto-start clock is, that delay might be fairly long.

I should probably implement something like that. My generator is set to automatically run an exercise cycle every other Saturday at noon. I use my SMTPd plugin to catch the email reports and do some notifications. But I don't have anything to notify me if it doesn't happen. Better get to work...

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

Posted on
Sat Jul 16, 2016 10:32 am
jay (support) offline
Site Admin
User avatar
Posts: 18219
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Action for something that did not happen as scheduled

FlyingDiver wrote:
Oh, I see what you mean. A delayed action on the vibration trigger that resets the flag AFTER the scheduled check runs. Depending on how accurate the auto-start clock is, that delay might be fairly long.


Fair enough, not knowing the details of how the trigger actually works I was just guessing. But long delays are fine, particularly since the solution only runs one day a week...

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Sat Jul 16, 2016 10:35 am
FlyingDiver offline
User avatar
Posts: 7215
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Action for something that did not happen as scheduled

Per my previous post, I started to add triggers and a schedule to Indigo to notify if my generator doesn't run on schedule. I'm making it more complicated, because I want to get a notification if it runs but doesn't shut off on schedule as well. ;)

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

Posted on
Wed Jul 20, 2016 2:12 pm
wideglidejrp offline
User avatar
Posts: 555
Joined: Jan 15, 2012
Location: Danbury, CT

Re: Action for something that did not happen as scheduled

The generator sensor and the ideas here worked well. Thanks! Now, I have a more general problem I am trying to solve. I want to be able to detect when I am NOT at home. I have a keypad and press D for depart and it sets off a set of actions, but sometimes I forget. I forget the A for arrive sometimes too, but I established a trigger so when the motion detector sees me, it executes the Arrive actions. I am looking for ideas to do the opposite: if I am NOT at home.

John R Patrick
Author of
Home Attitude

Who is online

Users browsing this forum: No registered users and 1 guest