Piston help with presence sensors


#1

I have a piston that runs when any of my families presence sensors arrives which does exactly that, the problem I have is that if more than one of us arrive together the piston runs multiple times and I get the waiting for semaphore warning message

Is there anyway through code or piston setting to recognise this and only run once regardless of how many people arrive together.

the basic code is
if any presence sensor is present
run my stuff

if all present sensors are not present
run some stuff

I have tried a few of the options but so far haven’t found the right one to use.


#2

Look for the command “execute on piston state change only.”


#3

Thanks, I assume I do this on the If statement

I also run this same piston at certain times throughout the day, will that option prevent it from entering at these times?

Also having looked at these and what they do, wouldn’t it be the condition state change I want to use, rather than the piston state change


#4

Yeah, “condition state change” maybe. I’m at work right now, so pardon my bluntness… It’s been a while since I’ve played around with those options, but I have a piston very similar to what you’re trying to do. I had to change some of those things around to get it to work.


#5

Hi @Rizlah

I will share my “welcome home” piston, which it’s based on two “presence sensors” and a motion sensor.
The Presence Sensors are in fact two Virtual Switches that are ON via IFTTT only when either my phone or my wife phone it’s in a specified range from our home.After this, i have inside my apartment a Xiaomi Motion Sensor.
If one of two Phones are presend in conjunction with the motion sensor, the piston runs a sequence of actions.

In the end of the piston it’s an improvisation of mine, I don’t think it’s the best way to do it, but it works for me.My problem with this setup was that when I am using the “followed by” function, usually it took almost 10 minutes until the piston run properly (changing the location mode to home and alexa speaking some welcome announcement ), so I’ve chosed to force run the piston once in 30 seconds only on Away mode, so now it takes max 30 seconds in which the piston runs perfectly.

Similarly I have a “Goodbye” Piston, where IF both Presence Sensors are OFF (when the phones are out of the specified IFTTT GPS range), the house enters to Away mode, and some other stuffs.If only one of the Presence Sensor it’s gone(me gone, my wife in the house) nothing happens.If you are interested, please let me know, I will post my piston here.

Please tell me if I can help you further.Hope it helps! :smiley:


#6

gives me some food for thought


#7

Do you think using a variable help you…
Use the variable as a condition AND after firs arrival variable changes to FALSE. Until you want it and no matter how many people arrive after, the piston will never fire because conditions are not met.

ie:

IF any of X Y V presence sensor changes to present
AND
IF variable ARRIVALS = TRUE
The do this 
do that 
Set Arrivals to FALSE