Timed Devices plugin

howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Timed Devices plugin

Post by howartp »

It sounds right to me.

Is there not an Action for the running timer, to reset it?


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

Re: Timed Devices plugin

Post by kmarkley »

welchgregusa wrote:Does anyone (kmarkley?) know whether the Running Timer is the appropriate (best) option? I'd like to know how long the valve was open today, this week, this month, etc. A Running Timer seems like the right one.
Yes, Running Timer is the correct device type to do this. In addition to this hour, day week, month, the device will provide the total for each of the prior 24 hours, 7 days, 4 weeks, and 1 year.
welchgregusa wrote:Assuming so, does anyone know if there is a way to reset the running count? I can't find any way to do so.
There is no way to reset the count. Not sure what the use case is as it could potentially delete quite a lot of data.

I suppose there could be a new, additional field to store running time since the last reset (and a reset would only clear this one field)...
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: Timed Devices plugin

Post by howartp »

Hi Kmarkley

I'm helping @farberm on another topic viewtopic.php?f=107&t=23484

We're trying to count activity within a period (hour, day).

Your activity timer should do it, if we set:
  • Threshold to a high number (9999)
  • Reset timer: 1 hour
  • Off timer: Irrelevant
  • Always Extend: Unchecked
With "Always extend" unchecked, it should never extend the timer as the threshold never reaches 9999, so should give us an accurate count within 1 hour.

However the plugin is still extending the timer when any true input is received, regardless of the setting of the Always Extend checkbox.

Can you have a look?

Peter
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Hi howartp.

The original purpose of the that device type is to infer continued activity from intermittent inputs. So the 'always extend' check box refers to the primary timer that switches the device back off after a period of inactivity and not the secondary timer used to decide when to turn the device on.

For example, say the device requires 3 pulses within 5 minutes to turn on and then turns off after an hour. If a pulse is received 15 minutes after turning on, 'always extend' determines if the device should turn off in 45 minutes (an hour after first turning on) or in an hour (an hour after this new pulse).

To have this setting also affect the reset timer would have adverse results. For example, suppose pulses were received at 0, 4, 6, and 8 minutes. The last three pulses were within 5 minutes and should turn the device on, but would not do so if the timer expired at the 5 minute mark.

It would possible to create a second, similar setting that only affects the reset timer, but I'm not sure that would really make this the best device type to use in your situation. I think your idea of a generic counting plugin makes more sense. There's a case to be made that it would be easy to roll this into my plugin by making what is essentially a cross between the Activity Timer and Running Timer device types. But it's different enough in purpose (i.e. not actually a timer) that it would probably be better in its own plugin.
vtmikel
Posts: 717
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: Timed Devices plugin

Post by vtmikel »

Hi kmarkley,

I updated to the latest version of the plugin and one of my Threshold Timers is no longer working. Here's a screenshot of the config for that device. I reverted to the previous version and it's working again.
Attachments
Screen Shot 2020-03-29 at 4.13.40 PM.png
Screen Shot 2020-03-29 at 4.13.40 PM.png (223 KiB) Viewed 6916 times
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Hi vtmikel.

I set up a timer like yours but am unable to reproduce the issue. It what manner is it not working?
vtmikel
Posts: 717
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: Timed Devices plugin

Post by vtmikel »

Sorry for the delay.

The device I took a screen shot of was a device I had set up using your plugin under a past version, and is now not working.

To test, I also created a new device, using the exact same setup. I notice that I get an error that "count out of sync [count:-1, max:1]" on the freshly created device. It also never turns "ON". In my test case, it is a threshold timer set to Sonos speaker's ZP_STATE, which is the field where it will say "PLAYING" if the Sonos is playing. Under the new version of the plugin, it does not turn on (the legacy threshold device, as well as the newly created device). On the past version of the plugin, it does trigger to on when the Sonos is playing, and begins a countdown to turn off based on the threshold amount. I use this to avoid unnecessary triggers during short pauses in my music.

Not sure what else to provide to reproduce?
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Sorry for my delay as well.

Unlike the other device types Threshold Timers keep an internal tally of your tracked device state and the error you are getting indicates that it is getting out of sync with the Indigo Server. Usually this a communication error and it will get back in sync after the error message. I don't understand why it keeps recurring in your case.

Please try the following:

- disable the countdown timer if enabled
- turn on debugging
- toggle the device state you are tracking from PLAYING to something else and then back again
- disable the timer device
- change the device state you are tracking (only one direction)
- enable the timer device
- toggle the device state you are tracking (both ways)
- disable the timer device
- change the device state you are tracking (only one direction)
- enable the timer device
- toggle the device state you are tracking (both ways)
- post what you get in the log
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Scratch all that. I think I figured out what was wrong.

Please try new plugin version on github here: https://github.com/kmarkley/Indigo-Time ... tag/0.0.25
vtmikel
Posts: 717
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: Timed Devices plugin

Post by vtmikel »

Installed the latest, got these errors:

Code: Select all

Apr 26, 2020 at 1:08:56 PM
   Reloading plugin "Timed Devices 0.0.25"
   Stopping plugin "Timed Devices 0.0.25" (pid 96337)
   Stopped plugin "Timed Devices 0.0.25"
   Starting plugin "Timed Devices 0.0.25" (pid 19951)
   Started plugin "Timed Devices 0.0.25"
   Z-Wave                          received "Master Bathroom Motion Sensor" status update is on
   Timed Devices                   "Master Bathroom Presence" on
   Script                          auto_lights script for Zone 'Master Bathroom': processing change to Master Bathroom Motion Sensor (action reason: the requisite conditions have been met: presence is detected for a OnOffZone, the zone is dark, and we are NOT using Timed Brightness Mode) : 
   Script                                 turning on 'Master Bathroom Vanity Lights'
   Timed Devices Debug             Debug logging enabled

Apr 26, 2020 at 1:09:40 PM
   Z-Wave                          received "Master Bedroom Closet Motion Sensor" status update is off
   Timed Devices Error             "Upstairs Presence" thread error 
global name 'rawVal' is not defined
Traceback (most recent call last):
  File "plugin.py", line 454, in run
    self.devChanged(arg1,arg2)
  File "plugin.py", line 494, in devChanged
    .format(self.name, newDev.name, stateKey, rawVal, type(rawVal), boolVal))
NameError: global name 'rawVal' is not defined
   Timed Devices Error             "Upstairs Presence 2 device threshhold" thread error 
global name 'rawVal' is not defined
Traceback (most recent call last):
  File "plugin.py", line 454, in run
    self.devChanged(arg1,arg2)
  File "plugin.py", line 494, in devChanged
    .format(self.name, newDev.name, stateKey, rawVal, type(rawVal), boolVal))
NameError: global name 'rawVal' is not defined
   Timed Devices Error             "Master Bedroom Presence Extended" thread error 
global name 'rawVal' is not defined
Traceback (most recent call last):
  File "plugin.py", line 454, in run
    self.devChanged(arg1,arg2)
  File "plugin.py", line 494, in devChanged
    .format(self.name, newDev.name, stateKey, rawVal, type(rawVal), boolVal))
NameError: global name 'rawVal' is not defined
   Timed Devices Error             "Master Bedroom Presence" thread error 
global name 'rawVal' is not defined
Traceback (most recent call last):
  File "plugin.py", line 454, in run
    self.devChanged(arg1,arg2)
  File "plugin.py", line 494, in devChanged
    .format(self.name, newDev.name, stateKey, rawVal, type(rawVal), boolVal))
NameError: global name 'rawVal' is not defined
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

Sorry, got ahead of myself.

Turn off verbose debugging and see if that works. If so, I'll release a new version that fixes this new error.
vtmikel
Posts: 717
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: Timed Devices plugin

Post by vtmikel »

Hi there-

Turning off verbose removed the crashes. And, the Threshold Timer that I previously had trouble with is now working. However, an Activity Timer that was previously working is not, I've attached the screenshot for the device config. No significant information in the Log to share, and I can see that the state value for the device I've attached to the Activity Timer is changing, but the device is not triggering.
Attachments
Screen Shot 2020-04-26 at 5.06.38 PM.png
Screen Shot 2020-04-26 at 5.06.38 PM.png (169.8 KiB) Viewed 6766 times
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Timed Devices plugin

Post by kmarkley »

vtmikel
Posts: 717
Joined: Fri Aug 31, 2012 12:45 pm
Location: Boston, MA
Contact:

Re: Timed Devices plugin

Post by vtmikel »

Working well so far.. thanks for your attention to this! Great plugin!


Sent from my iPad using Tapatalk Pro
BobRoss
Posts: 101
Joined: Sun Jan 15, 2006 2:13 pm
Location: Arizona
Contact:

Timed Devices plugin

Post by BobRoss »

I know this is going to be simple, But...

I want to know how long my HVAC ran today.

I found the Timed Devices Plugin and it's "Running Timer. I set it up to run when when the AC is on (living in AZ it runs a LOT)

I can see the time in the state field going up as it runs! Perfect. I would like to email be the run time at midnight.

I can't figure where to convert the state to a variable to email it

Can someone point me in the correct direction

Bob Ross
Post Reply

Return to “kmarkley's plugins”