Condition statement... Button on for less than specific amount of time?

Condition that triggers when Device button on <2 minutes

is this valid…

(HomeON; NOW < 2:00)

thanks

Looks good for under 2 minutes.

Would need a > if you want it greater than 2 minutes.

I did not know if NOW was still a non-specific time… thus, could be plus/minus another minute?

It is for Occupancy tracking so I’m trying to make sure that an Action does not trigger if Device has been on longer than 2 minutes… in other words, the person has been home for a while… only triggers once after they just arrived home

I’m still getting familiar with PLEG, so this isn’t a guarantee it will work.

I think you want (!HomeON;HomeON;NOW < 2:00) assuming HomeOn doesn’t false trigger often.

Have you thought about starting a timer when the button triggers? The now sequence expression only evaluates once a minute, so you will not get exactly two minutes.

It would go something like this:

ConditionA = HomeOn
Action for ConditionA starts a self start timer that runs 2 minutes =TimerOn
HomeOnLessThan2 = !HomeOn and TimerOn

PD

[quote=“pacificdune, post:5, topic:180621”]Have you thought about starting a timer when the button triggers? The now sequence expression only evaluates once a minute, so you will not get exactly two minutes.

It would go something like this:

ConditionA = HomeOn
Action for ConditionA starts a self start timer that runs 2 minutes =TimerOn
HomeOnLessThan2 = !HomeOn and TimerOn

PD[/quote]

[quote=“AgileHumor, post:4, topic:180621”]I’m still getting familiar with PLEG, so this isn’t a guarantee it will work.

I think you want (!HomeON;HomeON;NOW < 2:00) assuming HomeOn doesn’t false trigger often.[/quote]

Thank you both … any benefit of one method over the other?

I was thinking I’d use something like this…

(!AaronHome;AaronHome;NOW < 2:00) AND (StaySecureON or AwayON)

… but now I’m thinking I need to make it more complex.

… goal is to detect when I just arrived home and unlock the door ONLY when the Alarm is set to a specific mode.
… I don’t want it unlocking the door if I’ve already been home for a while and my phone just happens to drop the Wifi, be rebooting, whatever - thus the system ‘thinks’ I’ve been away a while, then when the phone comes back online it opens the door.

So… I’m now thinking I need to make it more like something where I need to watch for both how long I’ve been gone and also how long I’ve been home?

I think geofencing is an imperfect science. But a noble pursuit to come up with the perfect algorithm.

Here’s an example of a more simple Condition and I cannot get it to work correctly… any idea on why?

(Aaron or Robyn or Occupied) and (!SleepON; NOW > 2:00) and (!AwayON; NOW > 2:00) and (!StaySecureON; NOW > 2:00) and (!StayON; NOW > 2:00) and (!GuestSecureON; NOW > 2:00) and (!GuestON; NOW > 2:00) and (!VacationON; NOW > 2:00)

If any of the ‘ON’ Inputs are True, the Condition evaluates to TRUE and runs the Actions. For example… if SleepON is TRUE (ie. button is on), the Condition should be FALSE, correct?

I want that statement to evaluate to True ONLY when ALL of those buttons have been OFF for at least 2 minutes - so even if one of the buttons is on, it will not be True.

What am I missing?

The following two expressions are equivalent:
(!XXX; XXX; NOW …)

XXX and (XXX; NOW …)

[hr]
When you use:
(!SleepON; NOW > 2:00)
This is true 2 minutes after SleeepOn went FALSE … even if it’s true NOW.

You need to use:
(SleepOn; !SleepON; NOW > 2:00)
or:
!SleepON and (!SleepON; NOW > 2:00)

If you want it to mean that it’s OFF and it’s been OFF for more than 2 minutes.

thanks for the help.

One last head check…

Robyn AND ((Occupied; !Occupied; NOW > 2:00) OR (!AwayON; AwayON; NOW > 2:00) and (!StaySecureON; StaySecureON; NOW > 2:00) and (!GuestSecureON; GuestSecureON; NOW > 2:00) and (!VacationON; VacationON; NOW > 2:00))

… I think this means:
When Robyn becomes true AND ( Occupied has been OFF >= 2 minutes OR Specified Home Modes have been ON >= 2 minutes)