Thank you @WCmore for the suggestion to make PresenceCount a local variable and explaining that the test button will not replicate the required outcome correctly. Also thank you @qoheleth ror your additional comments and insight.
I think I may have caused some confusion with my explanation of what I am trying to accomplish, apologies. The use of a Message was only for placeholders for testing. I later planned to replace each Message with a task that would update a Global Variable(s). Those Global Variable(s) when changed would execute other Pistons or be used as a condition in other Pistons.
For example, these Pistons would depending on presence turn on or off, lights or music, double check doors are locked etc.
I currently have accomplish this by using a combination of IFTTT Applets that use the Life360 triggers called “First family member arrives at a specific place” and “Last family member leaves a specific place” respectively, then each are connected to a Webhooks action that makes a request to a WebCoRE Piston to run when the condition is met. Each individual IFTTT applets executes an individual Piston. (It’s a method I used in Stringify and it work for the most part.)
For example:
If
IFTTT executes ‘First_family_member_arrives’
then
etc. etc.
If
IFTTT executes “Last_family_member_leaves
then
etc. etc.
The issue I am having with this is sometimes IFTTT can have some latency and the applets run late, therefore the Piston runs late. My goal was to take out the two middlemen so to speak (IFTTT and Webhooks) hoping to run more efficiently. So, I attempted to build a test Piston in WebCoRE to take these functions over. I tried a number of different ways, but they failed. Hence my posting of the last Piston I attempted that failed also.
@qoheleth suggested Piston is much slicker than any of my attempts, I don’t use “CASE” enough and this example demonstrates for me a great use thereof. Again, thank you.
@webcore I am definitely looking for a method that will take into consideration “If both family members are in the same car” or arrive simultaneously…in other words if one phone geolocation updates before another phone updates and causes, as you have stated “First & Last member” to trigger. This is the issue I am struggling with as you can see by me trying to compensate in the first (above) posted Piston. I tried using:
If
Presence Sensor 2’s presence changes to present
followed within 3 minutes by
Presence Sensor 2’s presence changes to present
I have updated the Piston and posted it below based on how I was hoping it would run with each of your suggested changes. I have left the Message part in just for testing.
If someone could post a suggested alteration to this Piston that takes into consideration “almost simultaneously arrival” so that only the First to arrive is the triggered, I would greatly appreciate it.