Think this will work?
Arrival/departure if/then or case statement?
You’re getting there! That should work the way it’s written, I think. One change I would make is illustrated below.
Since you’re whole block is conditioned on “someone changes to home”, you know at least one person needs to be there. The first IF/Then works if it’s both of you, the second result is only Keith… if neither of those are true then the only option left is Renee is home. So I’d only have ELSE Set mode to Renee Home and push message…
Make sense?
Yup, I think that should work! Let me know if you have any issues and we’ll clean it up… but you should be done or close to it!
So far so good
Waiting for the gf to get home to see if the second part of the arrival works.
I posted on the webCore presense post that I am getting, “false”, arrivals. Meaning that my location is setting to, House, before I actually break the geofence. Not sure how I am going to work around that…
Glad to hear it! I’ve had some odd behavior with the webcore presence sensor too. I switched to using the Life360 app and the built-in SmartThings integration… So far it’s accurate 98% of the time I’d say. No false fires yet, just a few times I arrived home and it didn’t update for a few minutes. One limitation is it only sees presence at home (true or false) though.
[Install Instructions] webCoRE Presence Sensor on your iPhone (beta)
So how can I build a delay in my piston?
I think I had a start on it with setting a variable (which I am currently not using).
if( ([Renee Presence Sensor : currentPlace] == ‘Home’) && (age([Renee Presence Sensor : currentPlace])/60000 < 5) , 1, 0)
and
if( ([Keith Presence Sensor : currentPlace] == ‘Home’) && (age([Keith Presence Sensor : currentPlace])/60000 < 5) , 2, 0)
I just am not sure of the formatting etc.
Without writing it in an expression box to verify, that looks like it should work.
What is your piston doing (or has done) that you’re trying to build in a delay to fix? If I understand the problem there might be a different way to approach it.
So watching the logs and reading in the webCoRE application, the GPS accuracy may go to 100-150 meters. Since the roads I drive on are within that 100-150 meters, my current location changes momentarily from NULL to House. Looking at my ST logs, this is typically 10-20 seconds. It sounds like there is no way to ignore those updates, so it looks like I need to build some sort of delay in the piston to accommodate this.
Something like, don’t recognize the currentPlace = house unless it stays that way for say 15 seconds. I could then experiment with the delay so that I am not getting false piston execution.
Gotcha! In that case, you should be able to save yourself some complex conditions and use a trigger that says:
If the above results in repeating triggers (it shouldn’t, but I suppose it’s possible) then this statement would eliminate it:
I saw the, “stays,” trigger.
I suppose I could play with the settings and try to sort of filter out my false alarms.
I still wish there was a way in the webCoRE app to set your accuracy filters.
I’d try that for a bit and see if it works. Your arrives and stays home condition would be beaten to the punch for a few activities (setting lights and home/away modes) because your first block of code would have set it already.
There are some redundant conditions in there now - if I get some time this evening I’ll see if I can confirm they’re redundant and clean it up a little bit. Need a little more time to look at it and I’m ready to get out of the office!
So I think I got it to ignore the false arrivals.
Can you explain what the below examples mean?
Does the, “within,” look back that value (green)? Say 10 seconds. Then look to see if it, “stayed away from,” my value house for 10 minutes?
Also, do you know what Loose, Strict and Negated do?
The green “within” box defines the timer for the 2nd condition to become true after the first condition is evaluated.
For example, if we had:
IF
Garage door opens
Followed within 1 minute by
Kitchen door opens
Then
Close garage door
Turn garage lights off
etc.
The within 1 minute would be set in the green box you’re pointing at.
For the matching methods, I have some guesses but I’m afraid that’s all they would be. Probably better to get one of the minions to chime in on that one. Since @bangali was in this thread earlier, hopefully he won’t mind me tagging him back in.
at its root webcore is about event processing. each of those if conditions are checking the current event for a match. here that group of if condition is looking for a match between 2 events one followed by another.
suppose the event sequence received by that piston is as following:
- presence event from keiths phone
- motion event from hallway motion sensor
- presence event from renees phone
(somehow those names seem familiar … i vaguely remember some piston and that if condition … anyways …)
when you set the matching method to:
- loose = the motion event is ignored so when processing event #3 if condition will evaluate as true
- strict = the condition is reset when a non-matching event #2 is processed. so when processing event #3 that will become the first matching event for the condition and since there is no following presence event the if will evaluate as false
- negated = this evaluates as true when following event #1 event #3 is not recieved within 10 seconds
for more fun tag me on a thread when i have never been in it
Thanks for the info. Here is what I am trying to accomplish.
I am having issues with the webCoRE presence sensor (assuming the GPS accuracy is higher then 50-100m). In my picture above, what I am seeing is that my currentPlace is momentarily changing to, “House,” for about 10 seconds when I drive past my geofence. What I am trying to accomplish is, don’t trigger the arrival/departure statements unless my currentPlace changes to, “House,” and stays that way for at least 10 seconds. I can adjust the 10 seconds if I am seeing it is not long enough.
Would this be written in the following way?
IF
Any of the presence sensors currentPlace changes to "House"
followed (Strict, Loose or Negated?) within 10 minutes by
Any of the presence sensors currentPlace stays “House” for 10 seconds
If I literally read that it looks like we are looking back 10 minutes to see if any of the presence sensors currentPlace has stayed, “House,” for 10 seconds.
I think the way wecCoRE’s ‘stay’ works, you can reduce the number of statements to one. WebCoRE seems to subscribe to events for stay, so it will automatically trigger the piston on state change (negating the need for ‘if currentplace changes to house’).
Try just using:
IF presence sensor currentPlace stays House for 10 seconds.
The only problem I can see with the Stay clause, is now you could start seeing duplicate notifications. For example, if Renee was home, and then you came home an hour later - Renee also would have “stayed” home for 10 seconds.
You might need to add in a “has not changed in the last XX seconds” condition to work around that.
I assume this is what you meant.
Changing the, "changes to, “House”, to stays, “House,” for 10 seconds.