How to handle simultaneous conflicting events


#1

1) Give a description of the problem
I have a piston to set my thermostat to “away” when everyone leaves and back to “home” when someone arrives. I’m currently triggering it when the SmartThings “Goodbye!” and “I’m Back!” routines are executed, but at least once per week when I arrive home, these routines will fire multiple times in very rapid succession in a seemingly random order.

2) What is the expected behavior?
When I arrive home, the piston processes one of the “I’m Back!” events, and ignores all the other “I’m Back!” and “Goodbye!” events.

3) What is happening/not happening?
I first tried putting a 30 second wait as the first step in this piston, so that each new event would cancel the previous one, due to the Task Cancellation Policy. But since the events occur in a random order, the last event could be the “Goodbye!” event, and my thermostat doesn’t change to “home”.

So then I tried putting a 30 second lockout at the start of the piston, so that only the first event is processed and all subsequent ones are ignored. But this just reversed the problem I had before. If the “Goodbye!” event happens to be the first one, then my thermostat doesn’t change to “home”.

Has anyone else experienced a situation like this and have a better strategy for how to handle it?

The real piston is more complicated than this, but here’s the important parts of what I currently have (with the lockout):


#2

I may be unique in this strategy, but I have a couple of ways that my hub knows if I am home or not. (Phone connects to home WiFi, Presence sensor, and GPS via Tasker)

When any one of these is true, it turns on a Simulated Switch that means that I am home. All of my Welcome Home routines are triggered by the Simulated switch.

I do this because presence can be a bit finicky, so even though I have three triggers, they never trigger at the same time. And, by sending only one command (turn on SimSwitch) there can be no double actions. All the real meat & potatoes is in the SimSwitch piston.


SIDE NOTE :
I do a slight variation when leaving the house… 2 out of 3 must show me away from the house before my SimSwitch will turn off. (this is because presence sensors often hiccup, and may show me away for a minute before realizing that I never left.)

So far, with this method, I have not had a single false alarm


#3

Ah-ha! I like it. How are you checking when your phone connects to WiFi? Is it an alert that your phone provides or do you have something built into your router (or something else)?


#4

Neither. I am using webCoRE to make a GET request to my router to see if my phone is connected.

I have created two posts here detailing my strategy.


I also use Tasker on my phone to flip the same Simulated Switch when I arrive


#5

Awesome! Thank you for your help!