SecondsSinceLastChange

Plugin to show the SECONDS SINCE last change (in contrast to DATE OF last change) of a selected device/state in (almost) real time in a variable to enable triggers.
User avatar
matt (support)
Site Admin
Posts: 21450
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: SecondsSinceLastChange

Post by matt (support) »

Asconasny wrote:I will check the activity monitor if I'm nearby the server when/if it happens again.
If you notice an Indigo related process taking up a lot of CPU resources in the Activity Monitor, then get info on that process and copy/paste the contents of the Open Files and Ports tab. Each Indigo plugin runs in its own process, but by looking at the open file info you can figure out which plugin it is.

Another possible culprit would be any AppleScripts you might have Indigo executing. If those are run embedded in the Indigo Server then they can block other requests resulting in the timeous you've seen.
Image
User avatar
Hackencrash
Posts: 251
Joined: Wed Dec 16, 2015 7:05 am
Location: UK

Re: SecondsSinceLastChange

Post by Hackencrash »

I get a 404 on the download dropbox link on the first page :(
User avatar
kw123
Posts: 8420
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: SecondsSinceLastChange

Post by kw123 »

when I click on the link it works.
here the link again:
https://www.dropbox.com/s/nivfqjve2s5pk ... 7.zip?dl=1

Karl
User avatar
Hackencrash
Posts: 251
Joined: Wed Dec 16, 2015 7:05 am
Location: UK

Re: SecondsSinceLastChange

Post by Hackencrash »

OK, got it. I was using the link on the first page, similarly to how you do piBeacon updates and not using the link in the last post :oops:
User avatar
kw123
Posts: 8420
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: SecondsSinceLastChange

Post by kw123 »

sorry for that, I switch to that method just recently ..
User avatar
Hackencrash
Posts: 251
Joined: Wed Dec 16, 2015 7:05 am
Location: UK

Re: SecondsSinceLastChange

Post by Hackencrash »

OK it was worth a try.

I have a door which has two states: open (on) and closed (off). I was hoping this would give me the ability to give number of seconds since last opened AND number of seconds since last closed, but it just gives number of seconds since state change.

Oh well, no worries :)
User avatar
kw123
Posts: 8420
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: SecondsSinceLastChange

Post by kw123 »

it should do it:: last and last-1 change

called:
seconds_xxx
secondsPrevious_xxx
User avatar
Hackencrash
Posts: 251
Joined: Wed Dec 16, 2015 7:05 am
Location: UK

Re: SecondsSinceLastChange

Post by Hackencrash »

Yes I understand that, but then I'd have to check against the current state to see whether last -1 relates to last opened or last closed, so I may as well just do what I want in Python - was just being lazy and saw your plugin - that's all 8)
siclark
Posts: 1964
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: SecondsSinceLastChange

Post by siclark »

This looks like just the thing I wanted to be able to put time since each PIR last triggered on my Alarm control page, except some devices are not triggered for days, and even over a few minutes, it would be better to show this as minutes and hours since last trigger. ie if seconds < 60 then show seconds/60, if < 3600 show seconds / 3600 = minuets else seconds / 216000 = hours.
Is there an easy way to do this? Do I need to use code to create new variables again?
Cheers
User avatar
kw123
Posts: 8420
Joined: Sun May 12, 2013 4:44 pm
Location: Dallas, TX
Contact:

Re: SecondsSinceLastChange

Post by kw123 »

we could do that but then you need another variable to tell if it is sec/min/hour or you would need to parse the string
e.g. scripts do not like "55 min" you would then need to do

Code: Select all

value = indigo.variable["1862592591"].value
theSplit = value.split(" ")
theValue = theSplit[0]
theUnit  = theSplit[1] 
that is somewhat complicated and you could not just use indigos conditions since you must compare to a plain number..

if I understand your post correctly.

One way around it: your decision criteria for lets say >5 hours would be 5*3600 = 18000
if variable value > 18000 ... in the indigo condition page

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

Re: SecondsSinceLastChange

Post by howartp »

I think the EPS Device Extensions plugin can convert seconds to hours/minutes. Create a conversion device and point it at your secondssincelastchange value and tell it to format it.


Sent from my iPhone using Tapatalk Pro
siclark
Posts: 1964
Joined: Tue Jun 13, 2017 5:08 am
Location: UK

Re: SecondsSinceLastChange

Post by siclark »

Cheers... there is actually a time conversion from last changed property to now, which does exactly what I want. Need to spend more time going through all the plugins, seems like I want them all!
johnfdl
Posts: 177
Joined: Thu May 18, 2017 2:59 pm
Location: Atlanta, GA USA

Re: SecondsSinceLastChange

Post by johnfdl »

Link in first post to plug in download appears to be broken.
howartp
Posts: 4559
Joined: Thu Jan 09, 2014 4:43 pm
Location: West Yorkshire, UK

Re: SecondsSinceLastChange

Post by howartp »

https://www.dropbox.com/s/nivfqjve2s5pk ... 7.zip?dl=1

Karl has different URLs for each version and posts them throughout the thread as he updates things...

Not a method that's to everyone's tastes though!


Sent from my iPhone using Tapatalk Pro
johnfdl
Posts: 177
Joined: Thu May 18, 2017 2:59 pm
Location: Atlanta, GA USA

Re: SecondsSinceLastChange

Post by johnfdl »

Ahh....thanks.
Post Reply

Return to “SecondsSinceLastChange Plugin”