Timed Devices plugin

User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Timed Devices plugin

Post by berkinet »

Sorry for the delay responding. Things got busy here.

First, @howartp was right, I had the logic backwards. I actually had it right at one point, but somehow changed it. Oh well.

Then, kmarkeley wrote: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.

The monitored switch state is not changing and I don't think the Timed Device state is changing. I am going to add triggers on any state change in the switch or timed device to be sure of what is happening. But, in any case, the log indicates a state transition each time the ON timer expires. Here is a log excerpt:

Code: Select all

2017-08-23 17:25:07.034	Timed Devices	"Pool Full State" off
2017-08-23 17:30:07.442	Timed Devices	"Pool Full State" on
2017-08-23 17:30:07.453	Timed Devices	"Pool Full State" off
2017-08-23 17:35:07.900	Timed Devices	"Pool Full State" on
2017-08-23 17:35:07.910	Timed Devices	"Pool Full State" off
2017-08-23 17:40:08.399	Timed Devices	"Pool Full State" on
2017-08-23 17:40:08.410	Timed Devices	"Pool Full State" off
2017-08-23 17:45:08.909	Timed Devices	"Pool Full State" on
2017-08-23 17:45:08.918	Timed Devices	"Pool Full State" off
2017-08-23 17:50:09.363	Timed Devices	"Pool Full State" on
2017-08-23 17:50:09.372	Timed Devices	"Pool Full State" off
2017-08-23 17:55:09.911	Timed Devices	"Pool Full State" on
2017-08-23 17:55:09.920	Timed Devices	"Pool Full State" off
2017-08-23 18:00:10.588	Timed Devices	"Pool Full State" on
2017-08-23 18:00:10.597	Timed Devices	"Pool Full State" off
2017-08-23 18:05:11.316	Timed Devices	"Pool Full State" on
2017-08-23 18:05:11.326	Timed Devices	"Pool Full State" off
2017-08-23 18:10:12.027	Timed Devices	"Pool Full State" on
2017-08-23 18:10:12.036	Timed Devices	"Pool Full State" off
et.
and here are my device settings:
Attachments
Timed-Device.png
Timed-Device.png (102.39 KiB) Viewed 8358 times
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Could you please update to the latest version (0.0.10), turn on debug logging, and post the results?
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Timed Devices plugin

Post by berkinet »

kmarkley wrote:Could you please update to the latest version (0.0.10), turn on debug logging, and post the results?

Ok. here is the log. Note the messages from "Pool State Track." That is a trigger I have watching the onOffSTate of the timed device. There is also a similar trigger watching the input switch. It did not trigger.

Code: Select all

2017-08-23 19:23:44.902	Timed Devices	"Pool Full State" on
2017-08-23 19:23:44.912	Timed Devices Debug	"Pool Full State" input:  [newVal:False, onOff:True, pending:False]
2017-08-23 19:23:44.913	Timed Devices	"Pool Full State" off
2017-08-23 19:23:44.918	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:23:44.923	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:23:44.933	Timed Devices Debug	"Pool Full State" input:  [newVal:True, onOff:False, pending:False]
2017-08-23 19:23:44.944	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:28:45.401	Timed Devices	"Pool Full State" on
2017-08-23 19:28:45.412	Pool State Track	Pool full timed device state changed to True
2017-08-23 19:28:45.422	Timed Devices Debug	"Pool Full State" input:  [newVal:False, onOff:True, pending:False]
2017-08-23 19:28:45.423	Timed Devices	"Pool Full State" off
2017-08-23 19:28:45.432	Timed Devices Debug	"Pool Full State" input:  [newVal:True, onOff:False, pending:False]
2017-08-23 19:28:45.437	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:28:45.443	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:33:45.884	Timed Devices	"Pool Full State" on
2017-08-23 19:33:45.894	Timed Devices Debug	"Pool Full State" input:  [newVal:False, onOff:True, pending:False]
2017-08-23 19:33:45.895	Timed Devices	"Pool Full State" off
2017-08-23 19:33:45.900	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:33:45.906	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:33:45.912	Timed Devices Debug	"Pool Full State" input:  [newVal:True, onOff:False, pending:False]
2017-08-23 19:33:45.920	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:38:46.314	Timed Devices	"Pool Full State" on
2017-08-23 19:38:46.324	Timed Devices Debug	"Pool Full State" input:  [newVal:False, onOff:True, pending:False]
2017-08-23 19:38:46.325	Timed Devices	"Pool Full State" off
2017-08-23 19:38:46.330	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:38:46.336	Pool State Track	Pool full timed device state changed to False
2017-08-23 19:38:46.344	Timed Devices Debug	"Pool Full State" input:  [newVal:True, onOff:False, pending:False]
2017-08-23 19:38:46.356	Pool State Track	Pool full timed device state changed to False
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Thanks. I won't be able to dig into this until this evening, at the earliest.
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Timed Devices plugin

Post by berkinet »

kmarkley wrote:Thanks. I won't be able to dig into this until this evening, at the earliest.

No problem... Its after 10pm here anyway :wink:
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Well, I'm really chagrined at not having figured this out.

The plugin believes that your device "Pool Full Monitor" is changing state, and the plugin device is responding correctly to the apparent change (note that newVal in the log is alternating True/False) . Is there anything particularly weird about "Pool Full Monitor"? I don't see how your log results from anything other than Indigo reporting that its onOffState has changed....

1. I have posted another plugin release (v0.0.11) that adds even more debug logging. Please turn on verbose debugging from the plugin configuration and post the results. (You will also probably want to disable the countdown timer if it is enabled to avoid multiple log entries every second).

2. Try temporarily changing the monitored device to something that you can easily toggle manually. Does it behave correctly now?

3. Try temporarily setting both the on and off persist to 1 second. Does it change every second?

Sorry this not working for you.
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

It almost looks like "Pool Full State" and "Pool Full Monitor" are tracking each other in a circular fashion. It is passing strange that "Pool Full Monitor" onOffState always appears to go False (reversed in the plugin to newVal:True) within a fraction of a second after "Pool Full State" turns off -- and then the same on the reverse.

I don't imagine this is the case, but I have to ask: "Pool Full Monitor" is the actual physical switch in your pool, right?

Stupid question, but I'm grasping at straws here...
User avatar
berkinet
Posts: 3441
Joined: Tue Nov 18, 2008 2:08 pm
Location: Berkeley, CA, USA & Mougins, France

Re: Timed Devices plugin

Post by berkinet »

kmarkley wrote:... "Pool Full Monitor" is the actual physical switch in your pool, right? .

Yes. That is the physical switch. But wait, it gets weirder. I changed the input of the timed device to monitor a variable, and that worked as expected. Then, I changed it to a Z-Wave light switch, and that also worked as expected. Finally, I switched it back to the original switch and... it worked.!

Maybe there was something in the original device properties (created with plugin v 0.0.9) that caused the problem. Then, when I changed the device today, using 0.0.11, the corruption/error got updated/corrected. Just guessing. In any case, it seems to be working correctly now. Thanks.
stuartcolman
Posts: 81
Joined: Sun Nov 01, 2015 2:56 pm
Location: Essex, United Kingdom

Re: Timed Devices plugin

Post by stuartcolman »

I have a couple of questions or feature requests regarding the Activity timer.

Firstly could we track/monitor more than 5 devices. I have had a look through the code and manually changed this in mine, but obviously that change will be overwritten on the next version. As this plugin could be used to track motion sensors, some people may have more. A selection of device similar to the built in device group would be good.

Secondly, I am using this device to monitor motion sensors. Currently, I have some device groups and triggers to turn a virtual device on if any motion on any of the motion sensors, then when they are all off it starts a 15 minute countdown, if no movement, then this times out and sets the virtual device to 'off'. If motion is sensed during the 15 minutes, it cancels the timer and goes through the cycle again. I am trying to replicate this with the Activity Timer, but no luck. I have this already working for each motion sensor individually using the Persistence Timer, but that only seems to be able to monitor one device.

I just wanted to use the Activity Timer to reduce the amount of triggers and virtual devices being used.

Having a 'Run action on timer complete' part would be the icing on the cake :D
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Timed Devices plugin

Post by howartp »

Although I agree about more than 5 devices, I did what you're moving away from - 1 virtual device group that monitors as many motion sensors as I want, goes on when any is on, off when all off, then I include that in the timer.

You can trigger on timer complete already.


Sent from my iPhone using Tapatalk Pro
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

berkinet wrote:I switched it back to the original switch and... it worked.!
I'm glad it is working for you, but a bit flummoxed about why it stopped in the first place.

I did find a small bug that will be fixed in the next update where if you switch between tracking a device and a variable, it might continue to track the old entity. Might explain it or might not.
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

stuartcolman wrote:Firstly could we track/monitor more than 5 devices.
Absolutely. I'll get this in the next release shortly. Would 15 be enough?
stuartcolman wrote: A selection of device similar to the built in device group would be good.
The issue with this is the need to select both devices and associated device states. A multi-select list would not work well for this.
stuartcolman wrote:Secondly, I am using this device to monitor motion sensors. Currently, I have some device groups and triggers to turn a virtual device on if any motion on any of the motion sensors, then when they are all off it starts a 15 minute countdown, if no movement, then this times out and sets the virtual device to 'off'. If motion is sensed during the 15 minutes, it cancels the timer and goes through the cycle again. I am trying to replicate this with the Activity Timer, but no luck. I have this already working for each motion sensor individually using the Persistence Timer, but that only seems to be able to monitor one device.
This is exactly what Activity Timer devices are designed for. Based on your description, you should set:
Threshold: 1
Reset Cycles: 0
Reset Units: (anything)
Off Units: 15
Off Cycles: Minutes
Always ext?: checked

If that doesn't do it, please let me know in what manner it is not working.
stuartcolman wrote:Having a 'Run action on timer complete' part would be the icing on the cake :D
This can be done with a single trigger. Set your trigger to fire when the the device's 'Expired' state Becomes True.
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

New version 0.0.12:

• Activity Timers can track up to 20 devices and 10 variables
• Better initial device state, especially on plugin reload
• Fix bug when switching between tracking device and variable
• Thread cleanup in deviceStopComm

(plus the additional debug logging in versions 0.0.10 and 0.0.11)
stuartcolman
Posts: 81
Joined: Sun Nov 01, 2015 2:56 pm
Location: Essex, United Kingdom

Re: Timed Devices plugin

Post by stuartcolman »

kmarkley wrote:
stuartcolman wrote:Firstly could we track/monitor more than 5 devices.
Absolutely. I'll get this in the next release shortly. Would 15 be enough?
stuartcolman wrote: A selection of device similar to the built in device group would be good.
The issue with this is the need to select both devices and associated device states. A multi-select list would not work well for this.
stuartcolman wrote:Secondly, I am using this device to monitor motion sensors. Currently, I have some device groups and triggers to turn a virtual device on if any motion on any of the motion sensors, then when they are all off it starts a 15 minute countdown, if no movement, then this times out and sets the virtual device to 'off'. If motion is sensed during the 15 minutes, it cancels the timer and goes through the cycle again. I am trying to replicate this with the Activity Timer, but no luck. I have this already working for each motion sensor individually using the Persistence Timer, but that only seems to be able to monitor one device.
This is exactly what Activity Timer devices are designed for. Based on your description, you should set:
Threshold: 1
Reset Cycles: 0
Reset Units: (anything)
Off Units: 15
Off Cycles: Minutes
Always ext?: checked

If that doesn't do it, please let me know in what manner it is not working.
stuartcolman wrote:Having a 'Run action on timer complete' part would be the icing on the cake :D
This can be done with a single trigger. Set your trigger to fire when the the device's 'Expired' state Becomes True.
kmarkley wrote:Absolutely. I'll get this in the next release shortly. Would 15 be enough?
That is great, works brilliantly. Thanks :D

kmarkley wrote:The issue with this is the need to select both devices and associated device states. A multi-select list would not work well for this.
Understandable, not a major thing, I originally thought it would have been a good alternative to select loads of devices, but I hadn't thought it through.
kmarkley wrote:This is exactly what Activity Timer devices are designed for. Based on your description, you should set:
Threshold: 1
Reset Cycles: 0
Reset Units: (anything)
Off Units: 15
Off Cycles: Minutes
Always ext?: checked

If that doesn't do it, please let me know in what manner it is not working.
This sort of works. And it is working correctly to a point. With a sensor used for presence, I don't want the timer starting when the sensor sees movement, it should start when it goes back off. Which is fine and can be done by reversing the logic. However, now the activity timer will only track the off state. So if the sensor now comes back on it won't stop the timer until it goes back off again.

As an example. I am using a presence sensor in my kitchen. It monitors if anyone is in there, then when it goes off it runs a timer for 5 mins then switches the lights off. So if someone were to walk in, they would switch the light on, they would walk out and the timer would start the countdown. If they now walk in at 4mins 30secs and continue moving around (keeping the motion sensor on) the light will switch off in 30 secs, and not 5 mins after they finish.

kmarkley wrote:This can be done with a single trigger. Set your trigger to fire when the the device's 'Expired' state Becomes True.
Yeah I have that already, just thought it would be nice and keep everything in one place if it was all wrapped in the same thing. Again not a major thing.
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

stuartcolman wrote:This sort of works. And it is working correctly to a point. With a sensor used for presence, I don't want the timer starting when the sensor sees movement, it should start when it goes back off. Which is fine and can be done by reversing the logic. However, now the activity timer will only track the off state. So if the sensor now comes back on it won't stop the timer until it goes back off again.

As an example. I am using a presence sensor in my kitchen. It monitors if anyone is in there, then when it goes off it runs a timer for 5 mins then switches the lights off. So if someone were to walk in, they would switch the light on, they would walk out and the timer would start the countdown. If they now walk in at 4mins 30secs and continue moving around (keeping the motion sensor on) the light will switch off in 30 secs, and not 5 mins after they finish.
If your presence sensor is a single device (including a single virtual device that reflects multiple physical sensors), then a Persistence time will do what you want. The off timer won't start until the tracked device becomes off, and the persistence timer device will turn off when the timer expires.

Activity timers, as described in the first post, are designed primarily for momentary inputs, like a typical motion sensor. It sounds like your presence sensor holds it's on state for a while. I could theoretically start a timer at the last tracked off instead of the last tracked on, but I need to think through the implications of that.
Post Reply

Return to “kmarkley's plugins”