Help with timing of a piston


#1

1) Give a description of the problem
I’m trying to figure out a way to do the following and just cannot figure it out.
I have three presence sensors all tied to me. Smartthings, WebCore, and a Wi-Fi presence. All work great, and each have a different use. For the most part I use the 1st two to compliment each other to reduce false presence, and it works great. I use the Wi-Fi presence to unlock doors. Something I want to be much closer to the house. It also works great.

Sometimes for various reasons, I have my wi-fi off, and don’t realize it for a while. But maybe someone was already home, so the door did not need to be unlocked, etc. so I did not notice.

I want a piston that runs 15 minutes after I get home, that then checks to see if the wi-fi presence is present or not. But only once. I tried a 1st sensor “Stays present for 15”, and it worked kind of, but if I disconnected my wi-fi later it would trigger again.

Since there may be times I want my phone to be off wi-fi, I really only want this to run one time within the 1st 15 minutes of my arrival at home. Just basically a friendly nudge, that says “Hey, you’re not on wi-fi or there is something wrong.”


#2

Although not exactly the same as your scenario, I have something similar. I have two types of presence: Life360 and WiFi. (WiFi presence comes from IFTTT and ultimately sets a global variable in WC.) Here is what I came up with to let me know if the two disagree for too long:


#3

I get a bunch of false triggers with the presence sensor on my phone…so I work around them by using something like this:

If MyPhone’s presence changes to present
and
MyPhone’s presence was not present for at least 150 seconds

That way I don’t get my “Welcome home” type pistons running over and over again if my connection drops for whatever reason.

So you could do something like that to confirm you actually did just arrive. Then you can simply put in WAIT command in a piston for 15 minutes…but the important part would be to “Never Cancel” the tasks after the wait. You must do this as the Trigger (and default behavior of the piston) will be to cancel the tasks as your presence is no longer changing to present…it is present. Important distinction.


#4

I restrict the I’m back routine from only firing if I’m in Away mode. That way it only fires the first time the phone’s presence is detected. Works well when you have presence set up for multiple people also. If the house is already in home mode you don’t want to execute the same routine if no one was.


#5

I’m actually doing much better with false triggers. I have a simple piston that basically says if either Smartthings or Webcore change to present, then set a simulated presence sensor to present. and if either one shows away then set simulated presence sensor to away. I use the simulated presence sensor for most my “I’m back”, goodbye, etc routines. It’s been nearly flawless.

In my case I have a different issue. I want to know if I’m home, but my wi-fi is off. Since I have another presence sensor for wifi, I’d think it should be something like
simulated presence sensor arrives.
if wifi presence is not present within 15 minutes then send me a message

Problem is if I do simulated is present for at least 15 minutes and wifi present is not present, then the piston runs every time my wi-fi is disconnected for 15 minutes.

I want this to only run if wifi presence is not present within the 1st 15 minutes of my simulated presence becoming present.


#6

Yep. That’ the Trigger. Then Wait 15 minutes with a Never cancel in there then check:

If you never have any issues with false positives, then you don’t need to worry about anything else. When your simulated presence sensor changes to present…you know you’re home. So then just wait 15 minutes and check if you WIFI presence sensor is home in the same IF block.

IF simulated presence sensor changes to present
then (Never cancel)
Wait 15 minutes
IF WIFI presence sensor is not present
Then send the message

I suppose you could break it if you came home and then left again within 15 minutes…but perhaps that’s an edge case you don’t need to care about…

Another option would be to set a “lockout” timestamp variable and keep using the “stays” trigger.

That would look something like this:

IF Simulated PS changes to Present
then set Lockout (datetime variable) = addMinutes($now, 15)

IF Simulated PS stays present for 15 minutes
and
WIFI PS is not present
and
$now is less than Lockout
Then send your message

The Lockout timestamp will add a third condition which must also be true before the message is sent. So 2 hours after you’ve been home (or 16 minutes for that matter) the Lockout will prevent the rest of the statements from firing. You might have to get a little fuzzy with the Time you put in Lockout so that it works (as milliseconds matter) so maybe you add 16 minutes instead of 15…just to be sure.


#7

More examples in here:


#8

Thanks! I’ve used lockout based on the instructions in your tutorial, and it’s worked well. Did not even think about using it here. It worked perfectly


#9

You mention the “followed by” but I can’t seem to find that within WebCore. Some assistance, please?
And also…OMG…thank you!! So many new ideas I have to go through now to make things function better. :nerd_face:

Edit: Never mind…I found it. Have to input the second trigger first and then go back and change AND to FOLLOWED BY. That’s why i never found it before. But now I can’t seem to change the timing from 1 minute.


#10

Click on the trigger after the ‘followed by’, that’s where you can change the timing value.


#11

Ah ha!!! THANK YOU! Would have taken me forever to find that. :sunglasses: