Trying to write an expression. Variable changed to True in the last 10 mins

variables

#1

As per the title, I’m trying to incorporate in a piston -
If Variable changes to true in the last 10 minutes.
I can see that this can be done when using a device but not when you use a variable.
I’m assuming this can somehow be done using the expression field.
Not being a coder I have no idea how to do this.
Anyone out there who can give me some suggestions/guidance please.
TIA.


More variable options please. (If possible)
#2

No guidance here but just a suggestion :). What about setting up another variable that contains the time when that variable changes so you can key off of that.

If varTimeStamp < 10 minutes then perform tasks


#3

I looked at the age(device:attribute) function, but it only works with devices.

I then looked at the same thing @eibyer just recommended and tried to use ‘on events from…’ but when you choose variable it wont populate the variable names into the dropdown, similar issue as the ones @ipaterson patched the other day.

Just setting a timestamp after the set variable command will do the trick in this case though.

also:

If
variable changes
followed by within 10 minutes
some other trigger
Then
do stuff


#4

Thanks for your answers guys.
I already do it with a virtual device but I’m just trying to streamline all my pistons and have worked out a way using a variable (if I could do what I want with it :wink: ) which cuts a couple of statements out.
Thanks again.