Arrival of people including multiple people at once


#1

1) Give a description of the problem
None of the notifications are working

2) What is the expected behavior?
Depending on who arrives, a Push notification should go out and then the sonos will say a Welcome Message

3) What is happening/not happening?
None of the notifications or Welcome Messages are working.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
12/14/2017, 6:51:17 PM +524ms +2ms ╔Received event [Tom].presence = present with a delay of 94ms +132ms ║RunTime Analysis CS > 22ms > PS > 61ms > PE > 48ms > CE +136ms ║Runtime (53204 bytes) successfully initialized in 61ms (v0.2.100.20171211) (132ms) +137ms ║╔Execution stage started +155ms ║║Comparison (enum) present changes_to (string) present = true (1ms) +157ms ║║Cancelling condition #10's schedules... +158ms ║║Condition #10 evaluated true (15ms) +159ms ║║Cancelling condition #1's schedules... +160ms ║║Condition group #1 evaluated true (state changed) (18ms) +163ms ║║Cancelling statement #4's schedules... +169ms ║║Executed virtual command setVariable (4ms) +178ms ║║Calculating (string) Tom + (string) Arrived - >> (string) Tom Arrived - +181ms ║║Calculating (string) Tom Arrived - + (string) Thu, Dec 14 2017 @ 6:51:17 PM EST >> (string) Tom Arrived - Thu, Dec 14 2017 @ 6:51:17 PM EST +185ms ║║Tom Arrived - Thu, Dec 14 2017 @ 6:51:17 PM EST +188ms ║║Executed virtual command log (3ms) +195ms ║║Executed virtual command setVariable (3ms) +198ms ║║Cancelling statement #98's schedules... +230ms ║║Executed physical command [null].close() (27ms) +231ms ║║Executed [Home/Away Button].close (29ms) +240ms ║║Condition #75 evaluated false (5ms) +241ms ║║Condition group #11 evaluated false (state did not change) (6ms) +243ms ║╚Execution stage complete. (107ms) +244ms ╚Event processed successfully (244ms) 12/14/2017, 6:46:42 PM +560ms +2ms ╔Received event [Home/Away Button].contact = closed with a delay of 63ms +141ms ║RunTime Analysis CS > 22ms > PS > 63ms > PE > 56ms > CE +145ms ║Runtime (53213 bytes) successfully initialized in 63ms (v0.2.100.20171211) (141ms) +146ms ║╔Execution stage started +167ms ║║Cancelling condition #10's schedules... +168ms ║║Condition #10 evaluated false (17ms) +169ms ║║Cancelling condition #1's schedules... +170ms ║║Condition group #1 evaluated false (state changed) (18ms) +176ms ║║Comparison (enum) closed changes_to (string) closed = false (1ms) +177ms ║║Condition #75 evaluated false (5ms) +178ms ║║Condition group #11 evaluated false (state did not change) (6ms) +180ms ║╚Execution stage complete. (35ms) +182ms ╚Event processed successfully (181ms) 12/14/2017, 6:46:42 PM +319ms +1ms ╔Received event [Lauren].presence = present with a delay of 65ms +97ms ║RunTime Analysis CS > 13ms > PS > 42ms > PE > 43ms > CE +100ms ║Runtime (53209 bytes) successfully initialized in 42ms (v0.2.100.20171211) (98ms) +101ms ║╔Execution stage started +119ms ║║Comparison (enum) present changes_to (string) present = true (1ms) +121ms ║║Cancelling condition #10's schedules... +122ms ║║Condition #10 evaluated true (15ms) +123ms ║║Cancelling condition #1's schedules... +124ms ║║Condition group #1 evaluated true (state changed) (17ms) +127ms ║║Cancelling statement #4's schedules... +133ms ║║Executed virtual command setVariable (3ms) +142ms ║║Calculating (string) Lauren + (string) Arrived - >> (string) Lauren Arrived - +145ms ║║Calculating (string) Lauren Arrived - + (string) Thu, Dec 14 2017 @ 6:46:42 PM EST >> (string) Lauren Arrived - Thu, Dec 14 2017 @ 6:46:42 PM EST +149ms ║║Lauren Arrived - Thu, Dec 14 2017 @ 6:46:42 PM EST +151ms ║║Executed virtual command log (3ms) +157ms ║║Executed virtual command setVariable (2ms) +160ms ║║Cancelling statement #98's schedules... +189ms ║║Executed physical command [null].close() (25ms) +189ms ║║Executed [Home/Away Button].close (26ms) +199ms ║║Condition #75 evaluated false (5ms) +200ms ║║Condition group #11 evaluated false (state did not change) (7ms) +202ms ║╚Execution stage complete. (101ms) +203ms ╚Event processed successfully (203ms)

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


#2

Your code with the messages will only execute when Contact Sensor 1 changes to closed. It’s not driven by presence at all.

What is contact sensor 1?


#3

I have been working from this piston example https://community.webcore.co/t/arrival-piston-who-arrived/125?u=pcgirl65
In this piston, there is a contact sensor that he says he uses to indicate the action to have the speakers speak a sentence. I don’t have a contact sensor so I created a virtual contact sensor.


#4

Motion Sensor? Light switch? Can you give us an idea of some of the other devices you have?


#5

I have a motion sensor and light at the front foyer. Can this not work off of presence changing to ‘present’?


Arrival Piston - who arrived
#6

I think this is one of those double-trigger problems. There is a line in the log which reads “Condition group #11 evaluated false (state did not change)”. Same thing happened when Lauren got home. This must relate to line 44 where it checks Contact Sensor 1 for a trigger event. But the event that triggered the piston was a presence sensor change, so this whole IF doesn’t execute. If this were a condition instead (line 44: CS1 is closed) then I think it might work. Alternatively, I think you can move lines 43-75 into a separate piston to have it work off of that triggering event. If you do that, I don’t think you need the virtual sensor. I think you just call the piston directly. (I.e. replace lines 37-41 with a single piston call, and the other piston doesn’t need lines 43-47 and 70-74).

I also don’t think two Presence Sensors can ever trigger at exactly the same time, so I don’t think cases 3, 5, 6, or 7 will ever be true and announce more than one person in the same announcement. You’ve got it async, so I think what will happen is that you’ll hear up to 3 separate announcements for each individual.
To do it the way you’re envisioning, I think you’d have to delay the announcement by a little bit to let {WhoHome} collect everyone who is arriving within a window. I think I understand what needs to happen, but I don’t think I know how to.


#7

So are you using contact sensor 1 for anything, or is it just copied from the example? I think the code changes here would get you what you want… delete the WITH block for Contact Sensor 1 and use the same IF statement in your original IF in your async for messages, except modify it to “if presence sensor changes” rather than its current “if present sensor changes to present”.

If that doesn’t quite do it, post an update and we’ll figure it out.


#8

Do you enter through this foyer? If so take out your contact sensor stuff and change the Async if to motion sensor changes to active.

The 60000 is seconds to see if anyone else arrives. Yes 5 minutes. And no, it doesn’t wait 5 minutes to see if anyone else is going to arrive.

The gist is this…start building up a list of people that have arrived. Mostly for people coming home at the same time. However ST only see’s one person at a time and it will never see everyone at exactly the same time. So we need to build a list of everyone that has arrived. Once that door opens (or in this case your motion sensor triggers) it looks at the list of everyone that has arrived within the last 5 minutes and speaks their names. Once the names are spoken it resets the arrival list by turning anyonehome to false.

If you come home…and ST presence sensor sees you…but you don’t enter your foyer for 5 minutes(stand outside talking to the neighbor). It will not speak the names…as the 5 minutes have passed.

If you really just want to trigger on presence sensor…the second “async if” could be changed to “if any of presence sensors changes to present”…then a wait period, then the case statement.


#9

Sorry to sound so stupid but how is 60000 seconds 5 minutes? 60 seconds = 1 minute therefore 5 minutes would be 300 seconds, wouldn’t it? Take a look at this one. I have moved the virtual contact sensor change to close up to fire first. I have put back the Wait 5 minutes before setting the AnyoneHome = False. Will this work?


#10

Maybe it’s just the jet lag (it’s only 1pm and Friday has already been a 22 hour day for me, lol) but I’m struggling to figure out what the purpose of Contact Sensor 1 is. Are you reading it? I’m not understanding the “set to closed” statement or the reason you’re setting “anyone home” true and then false 5 minutes later.

Can you describe in a few lines what you want a piston to do - forget trying to modify an existing template, and I’ll see if we can drum something up that does JUST what you want it to do and nothing else?


#11

Sounds good! jrfarrar indicated that I needed a physical thing to do something for the rest of the piston to work. So I created a virtual contact sensor to set as Open or Closed. What I want to happen is that when family members arrive home they will be greeted with a Welcome Home greeting. However, the problem arouse when multiple people arrived at the same time. I want the greeting to say Welcome Home, Jane, Tom and Lauren or whomever is arriving. I am not sure if I need the virtual contact sensor or not. I would think that just the fact that someone’s presence changes should set the piston to complete the tasks. Although, it looks like I need something to trigger the Case Block.


#12

Sorry, I’m working and quickly replying which is never the best idea. I’m going to have to look back at to where I originally figured that out from. if it was milliseconds then it would be a minute not 5.


#13

I’d move the contact sensor close to below the set variable block because I think you want the anyonehome = true first. It’s the long way around it but it should work.


#14

Got it! I have an idea using a string variable. I’ll write something up later tonight if you’d like. I’m just boarding my last flight of the day (finally) and should have some downtime at home tonight.


#15

after the first person arrives may be wait 30 secs for additional presence sensors to arrive and then make the announcement with all of the names?


#16

So to add in here. I went through just about every presence piston I could find on the old thread over at the smartthings forum. The problem is the presence sensors all trip at different times. So you if trigger one and then wait…you have to pick a specific amount of time to wait. The beauty of the door closing is supposed to be that it announces you just as you actually enter the house. Theory being that once you close that door you and all the yous have just arrived and came in the house. The very nature of the timing of arriving home via a presence sensor be it one of the key fobs, the ST app or life 360 is they all trigger at different times. If I triggered at 30s after the first person arrived I wouldn’t even be in the garage yet let alone the house. My presence sensors trigger well outside the house.


#17

So I ran the piston that is just above a few posts and the only thing that is working is that in ST Notifications it is showing Jane Arrived - Fri, Dec 15, 2017 @ 4;42:00 PM EST. That is all that is working. I am not getting any Push notifications or greetings from sonos.
Here is the logs:
12/15/2017, 4:46:59 PM +118ms
+1ms ╔Received event [Home].time = 1513374420866 with a delay of -1748ms
+262ms ║RunTime Analysis CS > 33ms > PS > 170ms > PE > 59ms > CE
+266ms ║Runtime (53541 bytes) successfully initialized in 170ms (v0.2.100.20171211) (263ms)
+267ms ║╔Execution stage started
+287ms ║║Executed virtual command setVariable (3ms)
+302ms ║║Comparison (enum) closed is (string) closed = true (2ms)
+304ms ║║Condition #75 evaluated true (13ms)
+309ms ║║Comparison (boolean) false is (boolean) true = false (2ms)
+311ms ║║Condition #76 evaluated false (5ms)
+312ms ║║Condition group #11 evaluated false (state did not change) (21ms)
+315ms ║╚Execution stage complete. (49ms)
+317ms ╚Event processed successfully (316ms)
12/15/2017, 4:42:00 PM +645ms
+1ms ╔Received event [Jane].presence = present with a delay of 80ms
+119ms ║RunTime Analysis CS > 14ms > PS > 52ms > PE > 53ms > CE
+122ms ║Runtime (53539 bytes) successfully initialized in 52ms (v0.2.100.20171211) (120ms)
+123ms ║╔Execution stage started
+141ms ║║Comparison (enum) present changes_to (string) present = true (1ms)
+143ms ║║Condition #10 evaluated true (13ms)
+144ms ║║Condition group #1 evaluated true (state did not change) (14ms)
+146ms ║║Cancelling statement #98’s schedules…
+182ms ║║Executed physical command [null].close() (34ms)
+183ms ║║Executed [Home/Away Button].close (35ms)
+186ms ║║Cancelling statement #4’s schedules…
+191ms ║║Executed virtual command setVariable (2ms)
+200ms ║║Calculating (string) Jane + (string) Arrived - >> (string) Jane Arrived -
+203ms ║║Calculating (string) Jane Arrived - + (string) Fri, Dec 15 2017 @ 4:42:00 PM EST >> (string) Jane Arrived - Fri, Dec 15 2017 @ 4:42:00 PM EST
+207ms ║║Jane Arrived - Fri, Dec 15 2017 @ 4:42:00 PM EST
+209ms ║║Executed virtual command log (3ms)
+215ms ║║Executed virtual command setVariable (2ms)
+219ms ║║Executed virtual command wait (1ms)
+220ms ║║Requesting a wake up for Fri, Dec 15 2017 @ 4:47:00 PM EST (in 300.0s)
+225ms ║╚Execution stage complete. (101ms)
+226ms ║Setting up scheduled job for Fri, Dec 15 2017 @ 4:47:00 PM EST (in 299.996s)
+252ms ╚Event processed successfully (252ms)
12/15/2017, 4:41:30 PM +316ms
+1ms ╔Received event [Home].time = 1513374091751 with a delay of -1435ms
+148ms ║RunTime Analysis CS > 22ms > PS > 68ms > PE > 57ms > CE
+151ms ║Runtime (53540 bytes) successfully initialized in 68ms (v0.2.100.20171211) (149ms)
+152ms ║╔Execution stage started
+170ms ║║Executed virtual command setVariable (3ms)
+182ms ║║Comparison (enum) closed is (string) closed = true (3ms)
+183ms ║║Cancelling condition #75’s schedules…
+184ms ║║Condition #75 evaluated true (11ms)
+189ms ║║Comparison (boolean) false is (boolean) true = false (1ms)
+190ms ║║Cancelling condition #76’s schedules…
+191ms ║║Condition #76 evaluated false (6ms)
+192ms ║║Condition group #11 evaluated false (state did not change) (19ms)
+194ms ║╚Execution stage complete. (42ms)
+195ms ╚Event processed successfully (195ms)
12/15/2017, 4:36:31 PM +333ms
+1ms ╔Received event [Tom].presence = present with a delay of 83ms
+112ms ║RunTime Analysis CS > 17ms > PS > 43ms > PE > 52ms > CE
+115ms ║Runtime (53540 bytes) successfully initialized in 43ms (v0.2.100.20171211) (113ms)
+116ms ║╔Execution stage started
+134ms ║║Comparison (enum) present changes_to (string) present = true (1ms)
+136ms ║║Cancelling condition #10’s schedules…
+137ms ║║Condition #10 evaluated true (15ms)
+138ms ║║Cancelling condition #1’s schedules…
+139ms ║║Condition group #1 evaluated true (state changed) (16ms)
+141ms ║║Cancelling statement #98’s schedules…
+168ms ║║Executed physical command [null].close() (24ms)
+169ms ║║Executed [Home/Away Button].close (26ms)
+172ms ║║Cancelling statement #4’s schedules…
+178ms ║║Executed virtual command setVariable (2ms)
+396ms ║║Calculating (string) Tom + (string) Arrived - >> (string) Tom Arrived -
+399ms ║║Calculating (string) Tom Arrived - + (string) Fri, Dec 15 2017 @ 4:36:31 PM EST >> (string) Tom Arrived - Fri, Dec 15 2017 @ 4:36:31 PM EST
+404ms ║║Tom Arrived - Fri, Dec 15 2017 @ 4:36:31 PM EST
+406ms ║║Executed virtual command log (3ms)
+412ms ║║Executed virtual command setVariable (2ms)
+416ms ║║Executed virtual command wait (1ms)
+417ms ║║Requesting a wake up for Fri, Dec 15 2017 @ 4:41:31 PM EST (in 300.0s)
+422ms ║╚Execution stage complete. (306ms)
+424ms ║Setting up scheduled job for Fri, Dec 15 2017 @ 4:41:31 PM EST (in 299.995s)
+431ms ╚Event processed successfully (431ms)
12/15/2017, 2:26:23 PM +98ms
+1ms ╔Received event [Jane].presence = not present with a delay of 69ms
+122ms ║RunTime Analysis CS > 17ms > PS > 43ms > PE > 62ms > CE
+126ms ║Runtime (53541 bytes) successfully initialized in 43ms (v0.2.100.20171211) (124ms)
+127ms ║╔Execution stage started
+144ms ║║Comparison (enum) not present changes_to (string) present = false (1ms)
+146ms ║║Condition #10 evaluated false (13ms)
+147ms ║║Condition group #1 evaluated false (state did not change) (15ms)
+160ms ║║Comparison (enum) open is (string) closed = false (1ms)
+161ms ║║Condition #75 evaluated false (11ms)
+162ms ║║Condition group #11 evaluated false (state did not change) (12ms)
+164ms ║╚Execution stage complete. (37ms)
+165ms ╚Event processed successfully (165ms)
12/15/2017, 2:11:05 PM +555ms


#18

It’s dividing the time of age of the presence since present and diving by 60,000ms. which is 1 minutes. Then seeing if that is less than 5…make sense? the 5 is what you want to change if you want it longer or shorter


#19

using contact sensor actually makes it simpler. heres a quick version with configurable presence sensors, contact sensor and names to announce:


#20

This looks really complicated. This is definitely above my knowledge!