Timed Devices plugin

Posted on
Sat Aug 05, 2017 10:50 am
kmarkley offline
Posts: 50
Joined: Nov 15, 2016

Timed Devices plugin

This is a slightly strange widget/utility plugin that is a bit hard to explain. It is just intended to make it easier to setup/edit/maintain a few common (for me, at any rate) tasks that Indigo can actually do on it's own.

I think an example might help.

I wanted to track if an area of my house was 'active' (meaning in use by humans) based on 3 motion sensors. I made a counter to avoid false positives, that reset when a timer expired. When the counter reached a threshold, a variable was set to true. Another timer switched the variable to false if there was no motion sensed for a period of time. But if motion was sensed, the timer was restarted to it's initial value.

This all worked great, but required 13 Indigo entities (2 variables, 2 timers, and 9 triggers). I have now replaced all 13 with a single device from this plugin. Multiplied by several other areas needing similar treatment, and the benefit starts to become clear.

Ok, then. The specifics:

Activity Timer devices:

These devices infer an ongoing activity from one or more momentary inputs. The device will expire (turn off) after a defined period of time with no additional inputs.

Once configured, these devices are simply ON to indicate recent activity and OFF to indicate no recent activity.

The most common use is inferring activity in a room or area by tracking motion sensors. I commonly wish to have more than one motion sensor activate before assuming a room is in use, and extend the timeout when one or more motion sensors are re-activated.

Persistence Timer devices:

These devices track the state of a single device or variable, but only change state after the tracked entity state has persisted for a defined period of time.

Once configured, these devices are just ON or OFF to reflect the delayed/confirmed state of some other device or variable (eliminating the need for possibly several cancel-delayed-action actions).

An obvious example is the if you want to track if a door has been left open (or closed), but ignore the door being opened (or closed) momentarily.

Lockout Timer devices:

These devices track a single device or variable and change state immediately when the tracked entity changes, but will lockout (ignore) subsequent changes for a user-defined period of time. At the end of the lockout period, the plugin will reevaluate if the tracked entity has changed in the interim, and initiate another lockout period if it has.

Once configured, these devices are just ON or OFF to reflect the state of some other device or variable, but are guaranteed not to change more often than some pre-set period of time (allowing your triggered actions to complete before, say, reversing themselves).

Not sure there is an obvious example for this, but I do find it useful in a few situations, especially when I don't want on/off triggers to fire too close together.

---

To reiterate: this plugin doesn't do anything that can't be accomplished in Indigo with a combination of Triggers, Variables, and Timers and/or Delayed Actions. However, I find it very helpful in accomplishing those things quickly and simply. I have seen a number of new users on the forums struggle with these sorts of tasks, and hope this may be useful to them as well.


Details: https://github.com/kmarkley/Indigo-Time ... /README.md
Download: https://github.com/kmarkley/Indigo-Time ... ses/latest

Posted on
Sat Aug 05, 2017 11:18 am
jay (support) offline
Site Admin
User avatar
Posts: 12880
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Timed Devices plugin

Nice! Thanks once more for a great contribution.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Aug 08, 2017 2:33 am
berkinet offline
User avatar
Posts: 2774
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Re: Timed Devices plugin

Very 8) plugin. I am trying this out on my pool refill project. See this post

Posted on
Tue Aug 08, 2017 6:04 am
kmarkley offline
Posts: 50
Joined: Nov 15, 2016

Re: Timed Devices plugin

Thanks. I'm just glad someone else finds it useful.

Posted on
Fri Aug 11, 2017 2:08 pm
whmoorejr offline
User avatar
Posts: 165
Joined: Jan 15, 2013
Location: Houston, TX

Re: Timed Devices plugin

Lockout Timer devices.... Solution....

wired cameras (DSC) have no dwell time between triggers. Video Motion Detection (depending on software/purpose/setup) has no dwell time between motion detection versus zwave detectors which will only detect every so often...

I use a series of triggers that auto disable themselves (because I set them up before your plugin existed).

Example solution.... variety of motion sensors at the front entry to you house (Camera VMD, wired sensor, etc.). Since you probably don't get a new visitor every 15 minutes, use a lockout timer for those sensors so when you are performing a normal task (un-loading groceries from the car to the house) you aren't getting a ping on your phone every 2 seconds that there is something in your front yard.

I'm really looking forward to taking your plugin for a spin.... it will really clean up my trigger folders.

Posted on
Sat Aug 12, 2017 8:21 am
howartp offline
Posts: 2556
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Timed Devices plugin

Persistence Timer - Logic "Any"...

Has this disappeared?

I'd like to use this to track if a motion sensor hasn't changed state for 12 hours, which means the battery is likely dead/dying, but I'm only getting Simple and Complex?

Peter

Posted on
Sat Aug 12, 2017 9:15 am
kmarkley offline
Posts: 50
Joined: Nov 15, 2016

Re: Timed Devices plugin

howartp wrote:
Persistence Timer - Logic "Any"...
I'd like to use this to track if a motion sensor hasn't changed state for 12 hours, which means the battery is likely dead/dying, but I'm only getting Simple and Complex?


"Any" doesn't make sense for Persistence Timers because these devices track other devices/variables with a delay for persistence/confirmation -- if they went ON with any change, they would never go back OFF.

You can do want you want with an Activity Timer device -- these are the only ones that expire on their own. Set a threshold of 1, a single device/state, and a logic of "Any".

(BTW, because of the reset feature on Activity Timer devices, you can actually have two timers for a single device. Trigger one when state reset becomes true and another when state expired becomes true. )

Posted on
Sat Aug 12, 2017 9:17 am
howartp offline
Posts: 2556
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Timed Devices plugin

In that case, your Readme needs updating then :-)

It still has Any for persistence timers.


Sent from my iPhone using Tapatalk Pro

Posted on
Sat Aug 12, 2017 9:18 am
kmarkley offline
Posts: 50
Joined: Nov 15, 2016

Re: Timed Devices plugin

whmoorejr wrote:
.... it will really clean up my trigger folders.


This was my motivation for writing it. I was frequently confused by triggers I made myself...

Posted on
Sat Aug 12, 2017 9:21 am
kmarkley offline
Posts: 50
Joined: Nov 15, 2016

Re: Timed Devices plugin

howartp wrote:
In that case, your Readme needs updating then :-)


Thanks. Copy/paste error. Will fix.

Posted on
Mon Aug 14, 2017 7:33 am
vtmikel offline
Posts: 122
Joined: Aug 31, 2012
Location: Washington, DC

Re: Timed Devices plugin

Just wanted to say thanks. I've started using your plugin in a limited capacity but it's proving it's use already and I expect I will expand on its use.

Mike

Posted on
Mon Aug 14, 2017 11:50 am
howartp offline
Posts: 2556
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Timed Devices plugin

Ditto; I've already replaced a huge custom script that relied on loads of variables and associates timestamp triggers with a small number of timers.


Sent from my iPhone using Tapatalk Pro

Posted on
Sat Aug 19, 2017 1:07 am
berkinet offline
User avatar
Posts: 2774
Joined: Nov 18, 2008
Location: Berkeley, CA, USA & Mougins, France

Timed Devices plugin Question

I have a question on the operation of a Persistence Timer. This is being used to track a switch that is closed when the water in a swimming pool is below a certain level, and open when the water is above that level (i.e. "full"). Here is the device configuration:
Screen Shot 2017-08-19 at 08.29.05.png
Device Settings...
Screen Shot 2017-08-19 at 08.29.05.png (102.06 KiB) Viewed 115 times
I would expect this to set itself to On any time the monitored switch goes Off, and to set itself to Off after 10 On observations, at 1 minute intervals, from the switch.

In general, it seems to do that. However, I also see the following every 10 minutes (assuming the pool is full)
    19 Aug 2017, 05:25:10
    Timed Devices "Pool Full State" off
    Timed Devices "Pool Full State" on

    19 Aug 2017, 05:35:13
    Timed Devices "Pool Full State" off
    Timed Devices "Pool Full State" on

    19 Aug 2017, 05:45:16
    Timed Devices "Pool Full State" off
    Timed Devices "Pool Full State" on

    19 Aug 2017, 05:55:18
    Timed Devices "Pool Full State" off
    Timed Devices "Pool Full State" on

    19 Aug 2017, 06:05:21
    Timed Devices "Pool Full State" off
    Timed Devices "Pool Full State" on
Since I have checked the box to not suppress logging of on/off events, I would assume I should see a log entry overtime the state changes, not every 10 minutes when the timer expires but the state hasn't changed.

Is this the way the plugin should operete> Or, Am I misunderstanding something?

And, BTW, thanks again for a quite useful plugin.

Posted on
Sat Aug 19, 2017 2:26 am
howartp offline
Posts: 2556
Joined: Jan 09, 2014
Location: West Yorkshire, UK

Re: Timed Devices plugin

Haven't you got your On Persist and Off Persist the wrong way round? (Not the inputs - which you've correctly reversed)

Are you wanting this timer to go On when the pool is fully-full?

So lapping water as it gets nearly full won't turn it on, but water when it's stayed full for 10 minutes will do?

If so, set On Persist to 10 minutes, and Off Persist for some value (how many seconds of constant "not full" readings from switch before the timer goes off, ie says the pool really isn't full rather than someone dive bombing in it).


Sent from my iPad using Tapatalk Pro

Posted on
Sat Aug 19, 2017 7:57 am
kmarkley offline
Posts: 50
Joined: Nov 15, 2016

Re: Timed Devices plugin

berkinet wrote:
I would expect this to set itself to On any time the monitored switch goes Off, and to set itself to Off after 10 On observations, at 1 minute intervals, from the switch.

Not quite. With your configuration, the plugin device will turn On after the monitored switch has been Off for one second, and turn Off after the switch has remained On for 10 full minutes. Every time the monitored switch changes state, the plugin notices and cancels or restarts the timers (i.e. there is no 'sampling'). If this is not the behavior you want maybe you could describe your intent in a little more detail.

All that said, I still don't understand why you are getting those log entries.

berkinet wrote:
I would assume I should see a log entry overtime the state changes, not every 10 minutes when the timer expires but the state hasn't changed.

Could you elaborate? Are you saying the monitored switch state hasn't changed, the plugin device state hasn't changed, or both? If the monitored switch is changing, it would be helpful to see those changes in context with the plugin device log.

I have made the debug logging a bit more helpful and released an update. If you're still having issues, you can update the plugin and post the debug log.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 2 guests