Welcome Home piston help


#1

1) Give a description of the problem
When more than one person arrives at the same time, the message for everyone doesn’t work.
2) What is the expected behavior?
When people arrive home, a message says “Welcome Home {name}.” However when multiple people arrive at the same time, the message should be “Welcome Home Everyone”.

3) What is happening/not happening?
When multiple people arrive at the same time, the message is saying “Welcome Home {name}” but it is the name of the last person that the system picked up on.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach any logs (From ST IDE and by turning logging level to Full)
12/10/2017, 3:24:43 PM +749ms
+1ms
╔Received event [Tom].presence = present with a delay of 69ms
+139ms
║Runtime (40990 bytes) successfully initialized in 45ms (v0.2.0ff.20171129) (137ms)
+140ms
║╔Execution stage started
+201ms
║║Executed virtual command sendPushNotification (8ms)
+205ms
║║Executed virtual command wait (1ms)
+206ms
║║Requesting a wake up for Sun, Dec 10 2017 @ 3:27:43 PM EST (in 180.0s)
+211ms
║╚Execution stage complete. (72ms)
+212ms
║Setting up scheduled job for Sun, Dec 10 2017 @ 3:27:43 PM EST (in 179.994s)
+769ms
╚Event processed successfully (769ms)
12/10/2017, 3:18:08 PM +389ms
+1ms
╔Received event [Tom].presence = not present with a delay of 111ms
+159ms
║Runtime (40991 bytes) successfully initialized in 64ms (v0.2.0ff.20171129) (157ms)
+161ms
║╔Execution stage started
+232ms
║║Executed virtual command sendPushNotification (8ms)
+235ms
║╚Execution stage complete. (74ms)
+242ms
╚Event processed successfully (241ms)
12/10/2017, 2:56:48 PM +509ms
+1ms
╔Received event [Home].time = 1512935809626 with a delay of -1117ms
+168ms
║Runtime (40992 bytes) successfully initialized in 50ms (v0.2.0ff.20171129) (165ms)
+169ms
║╔Execution stage started
+189ms
║╚Execution stage complete. (21ms)
+211ms
╚Event processed successfully (211ms)
12/10/2017, 2:56:29 PM +234ms
+0ms
╔Received event [Home].time = 1512935790967 with a delay of -1733ms
+358ms
║Runtime (40993 bytes) successfully initialized in 254ms (v0.2.0ff.20171129) (357ms)
+360ms
║╔Execution stage started
+390ms
║║Executed virtual command httpRequest (3ms)
+391ms
║║Requesting a wake up for Sun, Dec 10 2017 @ 2:56:49 PM EST (in 20.0s)
+397ms
║╚Execution stage complete. (37ms)
+398ms
║Setting up scheduled job for Sun, Dec 10 2017 @ 2:56:49 PM EST (in 19.994s)
+413ms
╚Event processed successfully (413ms)
12/10/2017, 2:53:30 PM +712ms
+2ms
╔Received event [Tom].presence = present with a delay of 116ms
+173ms
║Runtime (40991 bytes) successfully initialized in 66ms (v0.2.0ff.20171129) (169ms)
+174ms
║╔Execution stage started
+250ms
║║Executed virtual command sendPushNotification (10ms)
+254ms
║║Executed virtual command wait (0ms)
+255ms
║║Requesting a wake up for Sun, Dec 10 2017 @ 2:56:30 PM EST (in 180.0s)
+260ms
║╚Execution stage complete. (87ms)
+262ms
║Setting up scheduled job for Sun, Dec 10 2017 @ 2:56:30 PM EST (in 179.994s)
+277ms
╚Event processed successfully (277ms)
12/10/2017, 2:53:10 PM +83ms
+2ms
╔Received event [Jane].presence = present with a delay of 112ms
+174ms
║Runtime (40996 bytes) successfully initialized in 63ms (v0.2.0ff.20171129) (171ms)
+176ms
║╔Execution stage started
+454ms
║║Executed virtual command sendPushNotification (10ms)
+458ms
║║Executed virtual command wait (1ms)
+459ms
║║Requesting a wake up for Sun, Dec 10 2017 @ 2:56:10 PM EST (in 180.0s)
+465ms
║╚Execution stage complete. (290ms)
+467ms
║Setting up scheduled job for Sun, Dec 10 2017 @ 2:56:10 PM EST (in 179.994s)
+481ms
╚Event processed successfully (480ms)
12/10/2017, 12:42:06 PM +299ms
+1ms
╔Received event [Jane].presence = not present with a delay of 127ms
+135ms
║Runtime (40996 bytes) successfully initialized in 48ms (v0.2.0ff.20171129) (134ms)
+137ms
║╔Execution stage started
+199ms
║║Executed virtual command sendPushNotification (9ms)
+202ms
║╚Execution stage complete. (66ms)
+209ms
╚Event processed successfully (208ms)
12/10/2017, 12:41:58 PM +937ms
+1ms
╔Received event [Tom].presence = not present with a delay of 144ms
+133ms
║Runtime (40991 bytes) successfully initialized in 38ms (v0.2.0ff.20171129) (131ms)
+134ms
║╔Execution stage started
+200ms
║║Executed virtual command sendPushNotification (8ms)
+203ms
║╚Execution stage complete. (69ms)
+211ms
╚Event processed successfully (211ms)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

It’s not possible for all 3 Presence devices to arrive at exactly the same moment, you can’t have multiple triggers in that way.

I can think of a rather long and complicated way to achieve a similar result, but you would need to delay the individual arrival notifications so they can be cancelled on arrival of additional sensors.

Something allong the lines of:

IF
any of x y or z’s Presence changes to present
and
age(device x’s name : presence) is less than 10000
and
age(device y’s name : presence) is less than 10000
and
age(device z’s name : presence) is less than 10000
THEN
send SMS - everyone just arrived

IF
any of x’s Presence changes to present
and
age(device y’s name : presence) is more than 10000
and
age(device z’s name : presence) is more than 10000
THEN (Cancel on condition change)
wait 10 seconds
send SMS - X just arrived

IF
any of y’s Presence changes to present
and
age(device x’s name : presence) is more than 10000
and
age(device z’s name : presence) is more than 10000
THEN (Cancel on condition change)
wait 10 seconds
send SMS - Y just arrived

IF
any of z’s Presence changes to present
and
age(device x’s name : presence) is more than 10000
and
age(device y’s name : presence) is more than 10000
THEN (Cancel on condition change)
wait 10 seconds
send SMS - Z just arrived

Problem arises when two out of the 3 turn up… that’s gonna need a whole load more IF’s lol


#3

OK, I see your point. Might be too complicated. I will think of something else.


#4

I created separate pistons for each device. Each piston will detect presence changing and perform actions independently to get around the issue. If we all leave or arrive at the same time we all get the welcome/goodbye messages.

I also have a “Anybody’s Home” simulated presence sensor that is updated based on the individual sensors (I call this directly from the above sensors) so that I can use it to trigger events based on anybody or nobody being home.

Its not too complicated but should work.


#5

That sounds very interesting. Never thought of doing that way. Can you post your “Anybody’s Home” piston so I can see how that one works?


#6

Hopefully this works. But this is the piston I use to update the Anybody’s home. You may need to modify it as I have some custom stuff in there for my home security system.

It is not automatically triggered by anything. Instead its called whenever one of my presence sensors changes so that it updates the Anybody’s home state. I also have it call another piston to update the home/away state. This way if somebody is already home and I arrive home it will disable the alarm for me when I arrive in case they had it set to Home/Stay mode at night.

Here is an example of one of the presence pistons I use. It monitors one presence sensor and if it changes will send the welcome/goodbye for that sensor and then call the update above to adjust the anybodys home sensor.

The presence sensor itself is a simulated sensor that is updated from another piston I have. But its a work in progress still but I’m setting it up to use multiple devices to help with the reliability. It does something like

“If my life360 is reporting I’m home or my network presence is detected at home then set my presence to home”

“If my life360 is reporting not home and my network presence is not detected then set my presence to away”

Still working on all the logic but it’s been pretty good so far.


#7

I can follow this for the most part but how do lines 32 and 41 work in your first piston?


#8

It is probably a virtual presence sensor. So they have to set the status since it can’t do it its self


#9

As said above. I have virtual presence sensor devices setup. That way I can control them via scripts. I use those sensors to trigger my other automation. Those lines basically set them to present or not present.


#10

In the first piston it call to execute “PresenceChanging” piston. What does that do?


Foolproof Alarm System Piston with dual Presence Sensors on each person?
#11

I found this in the examples and I think this will work for what I am trying to do. It has been setup to incorporate “Cases”. Check it out…
https://community.webcore.co/t/arrival-piston-who-arrived/125?u=pcgirl65