Where is the 30 seconds?
Arrival of people including multiple people at once
Seems to be working good now! I was just thinking that I might be able to use my Ring Doorbell at the front door for motion as it would be a good trigger for people just coming into the house. that way I could have the wait time lower. What do you think? I will have to play with it.
This is exactly what I use  if you use this your need to go back to my original piston again (the one I made for you with the GET).
 if you use this your need to go back to my original piston again (the one I made for you with the GET).
The only problem I have with the ring is it needed to be on normal sensitivity. Then because there is a road and path literally outside my door if I drive home I park on my garden opposite my house but if someone walks past before I get to the house it triggers. But I still get the push I just miss the speaker, thatâs why I have the wait on the arrive, so I try and run into my house to catch it  .
.
I was also going to suggest something else with your motion sensor again that would have made it work better but your dogâs triggering it early would always be a issue so the ring is better idea 
Arenât we a funny lot of people! I am the same way! My kids and hubbie doesnât care that the speakers greet them when they come home but I liked trying to get into the house to hear the greeting! Ha!
Have you seen these! Strips! These look really cool! Just ordered one to put on my garage door which is the other door that people use to enter the home.
Yeah seen them but over here their quite expensive. Iâm going to be using standard reed switches for doors and the window then using them to trigger the fibaro binary sensors. That way it strengthens the z wave network, it will also allow me to put temperature probs around the house and I wonât have to replace the batterys. 
Standard dumb security contacts that come as small bars or ones that get installed inside the door frame. They come in pairs one is a magnet the other the reed switch. But if I was starting again I would have looked at the new start up Konnected and used the reed switches.
Wow! I didnât know about the Konnected! That is exactly what I need as we moved into a house 3 years ago that had an old alarm system which we donât use. I thought just the other day, wouldnât it be nice to somehow integrate that into ST. I think I am going to pre-order one of these.
yeah looks good donât it  if I had known about it I wouldnât have brought so many universal binary sensors! Itâs also a great time to get one as its still cheap as on the kickstarter.
 if I had known about it I wouldnât have brought so many universal binary sensors! Itâs also a great time to get one as its still cheap as on the kickstarter.
I have an issue where the variable âiâ is being initialized to -1 so it is throwing a IndexOutOfBounds error.  Any help would be appreciated.
1/18/2018, 8:34:24 AM +329ms
+1ms	âReceived event [Scott Home].time = 1516289665203 with a delay of -874ms
+192ms	âRunTime Analysis CS > 15ms > PS > 39ms > PE > 138ms > CE
+197ms	âRuntime (59805 bytes) successfully initialized in 39ms (v0.2.102.20180116) (195ms)
+198ms	ââExecution stage started
+210ms	ââCalculating (datetime) 1516289664535 - (datetime) 1516289635203 >> (datetime) 29332
+215ms	ââComparison (datetime) 29332 is_greater_than (integer) 300000 = false (1ms)
+216ms	ââCondition #27 evaluated false (11ms)
+217ms	ââCondition group #24 evaluated false (state did not change) (13ms)
+244ms	ââCondition #20 evaluated false (20ms)
+261ms	ââCondition #56 evaluated false (17ms)
+262ms	ââCondition group #55 evaluated false (state did not change) (40ms)
+263ms	ââCondition group #11 evaluated false (state did not change) (41ms)
+273ms	ââComparison (time) 30864595 happens_daily_at (datetime) 1516289635203 = true (4ms)
+274ms	ââTime restriction check passed
+276ms	ââCancelling condition #49âs schedulesâŚ
+276ms	ââCondition #49 evaluated true (10ms)
+278ms	ââCancelling statement #49âs schedulesâŚ
+282ms	ââRequesting time schedule wake up at Fri, Jan 19 2018 @ 8:34:25 AM MST
+295ms	ââComparison (boolean) false is (boolean) false = true (2ms)
+296ms	ââCondition #48 evaluated true (12ms)
+297ms	ââCancelling condition #38âs schedulesâŚ
+298ms	ââCondition group #38 evaluated true (state changed) (33ms)
+300ms	ââCancelling statement #39âs schedulesâŚ
+306ms	ââExecuted virtual command setVariable (3ms)
+313ms	ââComparison (integer) 2 is_greater_than (integer) 0 = true (1ms)
+315ms	ââCancelling condition #65âs schedulesâŚ
+316ms	ââCondition #65 evaluated true (6ms)
+317ms	ââCancelling condition #61âs schedulesâŚ
+318ms	ââCondition group #61 evaluated true (state changed) (8ms)
+320ms	ââCancelling statement #52âs schedulesâŚ
+338ms	ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (2ms)
+364ms	ââCalculating (integer) 7 - (integer) -1 >> (integer) 8
+367ms	ââCalculating (integer) 8 - (integer) 2 >> (integer) 6
+373ms	ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 + (string) and >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and
+377ms	ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and + (string) ackson >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and ackson
+381ms	ââCalculating (integer) -1 > (integer) 0 >> (boolean) false
+386ms	ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (3ms)
+405ms	ââCalculating (integer) 7 - (integer) -1 >> (integer) 8
+407ms	ââCalculating (integer) 8 - (integer) 2 >> (integer) 6
+415ms	ââCalculating (integer) 2 == (integer) 1 >> (boolean) false
+424ms	ââCalculating (integer) 2 == (integer) 1 >> (boolean) false
+430ms	ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 + (string) and >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and
+435ms	ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and + (string) ackson >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and ackson
+438ms	ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and ackson + (string) have >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and ackson have
+442ms	ââCalculating (string) Jackson + (string) has >> (string) Jackson has
+445ms	ââCalculating (integer) -1 > (integer) 0 >> (boolean) false
+451ms	ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (3ms)
+460ms	ââCalculating (integer) 2 == (integer) 1 >> (boolean) false
+464ms	ââCalculating (string) Jackson has + (string) left home. >> (string) Jackson has left home.
+468ms	ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (2ms)
+480ms	ââCalculating (integer) 2 == (integer) 1 >> (boolean) false
+494ms	ââCalculating (integer) 2 == (integer) 2 >> (boolean) true
+500ms	ââCalculating (string) Goodbye + (string) Jackson >> (string) Goodbye Jackson
+503ms	ââCalculating (string) Goodbye Jackson + (string) , >> (string) Goodbye Jackson,
+506ms	ââCalculating (string) Goodbye Jackson, + (string) Jackson has >> (string) Goodbye Jackson, Jackson has
+509ms	ââCalculating (string) Goodbye Jackson, Jackson has + (string) left. >> (string) Goodbye Jackson, Jackson has left.
+513ms	ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (2ms)
+539ms	ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].sendNotificationToContacts (20ms)
+552ms	ââComparison (time) 30864872 is_between (time) 21600000 ⌠(time) 86340000 = true (7ms)
+553ms	ââTime restriction check passed
+555ms	ââCondition #75 evaluated true (12ms)
+555ms	ââCondition group #74 evaluated true (state did not change) (13ms)
+557ms	ââCancelling statement #74âs schedulesâŚ
+837ms	ââExecuted physical command [Family Room Speaker].speak([Goodbye Jackson, Jackson has left.]) (274ms)
+838ms	ââExecuted [Family Room Speaker].speak (277ms)
+1797ms	ââExecuted physical command [Lannouncer S8+].speak([Goodbye Jackson, Jackson has left.]) (957ms)
+1798ms	ââExecuted [Lannouncer S8+].speak (958ms)
+1801ms	ââCancelling statement #76âs schedulesâŚ
+1808ms	ââExecuted virtual command setVariable (3ms)
+1813ms	ââExecuted virtual command setVariable (2ms)
+1816ms	ââExecution stage complete. (1618ms)
+1818ms	âSetting up scheduled job for Fri, Jan 19 2018 @ 8:34:25 AM MST (in 86399.057s)
+1827ms	âEvent processed successfully (1827ms)
When you look at the piston in Webcore it shows that the variable for i is equal to -1 in the beginning. It then sets it later on in the piston.
Echo Arrival/Departure with voicemonkey
your using a slightly different version of the piston but looks ok; once you have ran it it should clear correctly; are you still getting errors?
I did take the latest version posted above and made some minor tweaks (my presence sensors, my speakers ⌠nothing major different).  It does seem to run and I am getting the results I expect.  However when I look at the log I see the IndexOutOfBounds error and the variable âiâ is being set at -1?  I am not positive, but I believe it may be set in this statement:
set variable {i} = indexOf(pSensors, $currentEventDevice)
I am guessing that it is not finding $currentEventDevice in the pSensor array so it is set to -1? I have not had time to continue to debug this, but my guess is the variable {i} is then reset later on and therefore the rest of the script works?? When I look at the list of local variables and their values (on the right hand side of the piston dashboard) it shows that {i} is equal to -1, even after the piston has been run multiple times.
Hopefully I will have some time this weekend to continue to look into this.
Yes this is supposed to happen as, @bangali did the original code hes the man to speak to. But as I understand it this bit works out which person has left and how many have left.
You donât need to worry that the variable is stored at -1 at the end of the piston eather as everytime it runs it rechekâs it and changes it if its needed. Your find if more than one person leaves it will change.
Thanks. As I said the piston does seem to be performing the functions properly. I was just concerned that I fat-fingered something when I saw the error in the logs. I will monitor and ignore as long as it still continue to function. Thanks for your input.
that should not happen. that section of the code is only executed for the named presence sensors so it should always find the indexof value.
it could be happening on the lastindexof statement further down. if you have time to debug this further please let me know.
thanks.
Okay. Went back to the piston I was using when I first noticed the error in the log. I have added logs for the variables so I could see what they were at trhe time it runs and the Piston is below:
I think it is the lastIndexOf(who[whoI], ) on line 152 that is the problem as that is evaluating to -1 ⌠but I do not know why?
|+2ms|âReceived event [Scott Home].time = 1516481285036 with a delay of -908ms|
|â|---|
|+225ms|âRunTime Analysis CS > 19ms > PS > 77ms > PE > 128ms > CE|
|+229ms|âRuntime (65837 bytes) successfully initialized in 77ms (v0.2.102.20180116) (225ms)|
|+230ms|ââExecution stage started|
|+242ms|ââCalculating (datetime) 1516481284366 - (datetime) 1516481255036 >> (datetime) 29330|
|+251ms|ââComparison (datetime) 29330 is_greater_than (integer) 300000 = false (6ms)|
|+252ms|ââCancelling condition #27âs schedulesâŚ|
|+253ms|ââCondition #27 evaluated false (16ms)|
|+254ms|ââCancelling condition #24âs schedulesâŚ|
|+255ms|ââCondition group #24 evaluated false (state changed) (18ms)|
|+258ms|ââCancelling statement #77âs schedulesâŚ|
|+266ms|ââCalculating (string) LOG: The value of i is = + (string) 0 >> (string) LOG: The value of i is = 0|
|+269ms|ââCalculating (string) LOG: The value of i is = 0 + (string) (line 59) >> (string) LOG: The value of i is = 0 (line 59)|
|+273ms|ââLOG: The value of i is = 0 (line 59)|
|+274ms|ââExecuted virtual command log (2ms)|
|+300ms|ââCondition #20 evaluated false (20ms)|
|+316ms|ââCondition #56 evaluated false (15ms)|
|+318ms|ââCondition group #55 evaluated false (state did not change) (37ms)|
|+319ms|ââCondition group #11 evaluated false (state did not change) (39ms)|
|+328ms|ââComparison (time) 49684450 happens_daily_at (datetime) 1516481255036 = true (4ms)|
|+330ms|ââTime restriction check passed|
|+331ms|ââCancelling condition #49âs schedulesâŚ|
|+332ms|ââCondition #49 evaluated true (11ms)|
|+342ms|ââCancelling statement #49âs schedulesâŚ|
|+347ms|ââRequesting time schedule wake up at Sun, Jan 21 2018 @ 1:48:05 PM MST|
|+360ms|ââComparison (boolean) false is (boolean) false = true (2ms)|
|+361ms|ââCancelling condition #48âs schedulesâŚ|
|+362ms|ââCondition #48 evaluated true (13ms)|
|+363ms|ââCancelling condition #38âs schedulesâŚ|
|+364ms|ââCondition group #38 evaluated true (state changed) (43ms)|
|+367ms|ââCancelling statement #39âs schedulesâŚ|
|+373ms|ââExecuted virtual command setVariable (3ms)|
|+380ms|ââComparison (integer) 2 is_greater_than (integer) 0 = true (2ms)|
|+382ms|ââCancelling condition #65âs schedulesâŚ|
|+383ms|ââCondition #65 evaluated true (6ms)|
|+384ms|ââCancelling condition #61âs schedulesâŚ|
|+385ms|ââCondition group #61 evaluated true (state changed) (8ms)|
|+387ms|ââCancelling statement #81âs schedulesâŚ|
|+395ms|ââCalculating (string) LOG: The value of i is = + (string) 0 >> (string) LOG: The value of i is = 0|
|+398ms|ââCalculating (string) LOG: The value of i is = 0 + (string) (line 143) >> (string) LOG: The value of i is = 0 (line 143)|
|+402ms|ââLOG: The value of i is = 0 (line 143)|
|+403ms|ââExecuted virtual command log (1ms)|
|+406ms|ââCancelling statement #52âs schedulesâŚ|
|+439ms|ââCalculating (integer) 7 - (integer) 0 >> (integer) 7|
|+442ms|ââCalculating (integer) 7 - (integer) 2 >> (integer) 5|
|+449ms|ââCalculating (string) + (string) and >> (string) and|
|+453ms|ââCalculating (string) and + (string) eyson >> (string) and eyson|
|+456ms|ââCalculating (integer) 0 > (integer) 0 >> (boolean) false|
|+464ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (4ms)|
|+472ms|ââCalculating (string) LOG: The value of whoI is = + (string) 2 >> (string) LOG: The value of whoI is = 2|
|+475ms|ââCalculating (string) LOG: The value of whoI is = 2 + (string) (Line 150) >> (string) LOG: The value of whoI is = 2 (Line 150)|
|+479ms|ââLOG: The value of whoI is = 2 (Line 150)|
|+480ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].log (2ms)|
|+488ms|ââCalculating (string) LOG: The value of who[whoI] is = + (string) Greyson >> (string) LOG: The value of who[whoI] is = Greyson|
|+491ms|ââCalculating (string) LOG: The value of who[whoI] is = Greyson + (string) (Line 151) >> (string) LOG: The value of who[whoI] is = Greyson (Line 151)|
|+495ms|ââLOG: The value of who[whoI] is = Greyson (Line 151)|
|+496ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].log (1ms)|
|+513ms|ââCalculating (string) ) is = + (string) -1 >> (string) ) is = -1|
|+516ms|ââCalculating (string) ) is = -1 + (string) (Line 152) >> (string) ) is = -1 (Line 152)|
|+519ms|ââCalculating (string) LOG: The value of lastIndexOf(who[whoI], , (string) ) is = -1 (Line 152) >> (string) LOG: The value of lastIndexOf(who[whoI], ) is = -1 (Line 152)|
|+524ms|ââLOG: The value of lastIndexOf(who[whoI], ) is = -1 (Line 152)|
|+525ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].log (1ms)|
|+535ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (3ms)|
|+543ms|ââCalculating (string) LOG: The value of i is = + (string) -1 >> (string) LOG: The value of i is = -1|
|+546ms|ââCalculating (string) LOG: The value of i is = -1 + (string) (Line 154) >> (string) LOG: The value of i is = -1 (Line 154)|
|+550ms|ââLOG: The value of i is = -1 (Line 154)|
|+551ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].log (1ms)|
|+570ms|ââCalculating (integer) 7 - (integer) -1 >> (integer) 8|
|+573ms|ââCalculating (integer) 8 - (integer) 2 >> (integer) 6|
|+581ms|ââCalculating (integer) 2 == (integer) 1 >> (boolean) false|
|+593ms|ââCalculating (integer) 2 == (integer) 1 >> (boolean) false|
|+603ms|ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 + (string) and >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and|
|+610ms|ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and + (string) reyson >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and reyson|
|+617ms|ââCalculating (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and reyson + (string) have >> (string) java.lang.StringIndexOutOfBoundsException: String index out of range: -1 and reyson have|
|+622ms|ââCalculating (string) Greyson + (string) has >> (string) Greyson has|
|+626ms|ââCalculating (integer) -1 > (integer) 0 >> (boolean) false|
|+632ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (3ms)|
|+640ms|ââCalculating (integer) 2 == (integer) 1 >> (boolean) false|
|+644ms|ââCalculating (string) Greyson has + (string) left home. >> (string) Greyson has left home.|
|+649ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (3ms)|
|+661ms|ââCalculating (integer) 2 == (integer) 1 >> (boolean) false|
|+675ms|ââCalculating (integer) 2 == (integer) 2 >> (boolean) true|
|+680ms|ââCalculating (string) Farewell + (string) Greyson >> (string) Farewell Greyson|
|+683ms|ââCalculating (string) Farewell Greyson + (string) , >> (string) Farewell Greyson,|
|+686ms|ââCalculating (string) Farewell Greyson, + (string) Greyson has >> (string) Farewell Greyson, Greyson has|
|+689ms|ââCalculating (string) Farewell Greyson, Greyson has + (string) gone out. >> (string) Farewell Greyson, Greyson has gone out.|
|+694ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].setVariable (2ms)|
|+778ms|ââExecuted virtual command [Family Room Speaker, Lannouncer S8+].sendNotificationToContacts (79ms)|
|+791ms|ââComparison (time) 49684910 is_between (time) 21600000 ⌠(time) 86340000 = true (7ms)|
|+793ms|ââTime restriction check passed|
|+795ms|ââCondition #75 evaluated true (14ms)|
|+796ms|ââCondition group #74 evaluated true (state did not change) (15ms)|
|+798ms|ââCancelling statement #74âs schedulesâŚ|
|+1328ms|ââExecuted physical command [Family Room Speaker].speak([Farewell Greyson, Greyson has gone out.]) (523ms)|
|+1329ms|ââExecuted [Family Room Speaker].speak (524ms)|
|+2126ms|ââExecuted physical command [Lannouncer S8+].speak([Farewell Greyson, Greyson has gone out.]) (795ms)|
|+2127ms|ââExecuted [Lannouncer S8+].speak (797ms)|
|+2130ms|ââCancelling statement #76âs schedulesâŚ|
|+2136ms|ââExecuted virtual command setVariable (4ms)|
|+2142ms|ââExecuted virtual command setVariable (2ms)|
|+2146ms|ââCancelling statement #84âs schedulesâŚ|
|+2155ms|ââCalculating (string) LOG: The value of i is = + (string) -1 >> (string) LOG: The value of i is = -1|
|+2158ms|ââCalculating (string) LOG: The value of i is = -1 + (string) (line 187) >> (string) LOG: The value of i is = -1 (line 187)|
|+2162ms|ââLOG: The value of i is = -1 (line 187)|
|+2163ms|ââExecuted virtual command log (1ms)|
|+2167ms|ââExecution stage complete. (1936ms)|
|+2168ms|âSetting up scheduled job for Sun, Jan 21 2018 @ 1:48:05 PM MST (in 86398.74s)|
|+2176ms|âEvent processed successfully (2176ms)|
change that line to:
set i = (contains(who[whoI], â,â) ? lastIndexOf(who[whoI], â,â) : -1)
 
      
    

