Arrival of people including multiple people at once


#29

sorry to tag on but i have been trying to do the same with one that wasn’t working fully. I have taken @pcgirl65 and adapted it to mine would this work correctly with also letting you know who left?

The only thing I don’t understand is the GET request, what is that for?


#30

The GET request allows me to connect through my Sonos speakers through a node server on my unraid server. I can do more with the speakers and the speech is more natural.


#31

Like the sound of that how do I do it :smile:


#32

I posted how I did it here . If you need help, let me know.


#33

Is your piston working?


#34

yes but i made a few changes to get it working better will edit my post again when i’m done. The only thing that doesn’t seem to work quite right is on the leave if we both leave it says “emma, steven” rather than “and” where as the arive does “and”.


Presence senor info and advice needed
#35

Edit: piston superseded

Hoping this will work with my ring doorbell but still have to do some tests not sure if the add 1 to the variable on each loop is right or not yet. also still need to work out the “and” bit. @bangali could you shed any light on that?


#36

lines 46 thru 51 does the and part. was that what you were looking for?


#37

Not quite, I straight copied that and it works but because I use it twice ( for the else) it doesn’t seem to work the 2nd time. I’m also struggling to count every times it runs on the arrive side. I wanted it to count every time it ran and added that too the speakerCount variable so that if it looks more than twice it breaks and clears the variables.


#38

sorry didnt quite get this part?


#39

I copied your code for “then” and used it twice on the same piston. 1st where it originally was then again on the else part of the IF.

IF pressence changes to present
Then do X (run your code for whoArived)
Else do Y (run your code for whoLeft)


#40

This should work now it also has protection in it to stop it looping if you use a presence detector to trigger the speaker like I have.

@bangali I created another integer of “ii” and swapped that in you code for my else part so the and should work now :slight_smile:

edit: the “and” still doesn’t quite work :frowning:


#41

ahh ok. shouldnt require a copy of the entire code … using a conditional setting for arrived or departed should also work.


#42

how would that be done?


#43

i will post an example later.

just to be sure - you are looking to announce arrivals and departures. arrivals with contact sensor closing and departures after 30 secs from last departure?


#44

This piston is working great so far, apart from the and I think. Let me know if you can improve it.

Yes to arrivals /departures for single and multiple people. But log and announce arrivals (log only once but announce up to twice (just in case not in building yet)).

For departures log someone or more than one leaves and announce only if someone is still in the house and only once for both.

For me im using the motion stopping as I don’t have a door contact installed yet. But yes it would be better if i could have it so it happens 30 secs from last departure (at the moment its the same as arrive).

All this happens on my current piston apart from the departure after 30 seconds bit.

Edit: would this do that, ($now - lastNow) is equal to 30000?


#45

well if its working for you i dont need to write up another example. :slight_smile:

sorry thought you had some issues with the double copy portions of the code and that needed fixing or something.


#46

Yeah still having a issue with the text bit but the main bit I think it running well. Still need to run it abit more to be sure. I would also like to trigger the leave bit 30s after the last departure, rather than the contact, could you show me how to do that please?


#47

try this:


Help with Arrival Piston (Sonos Welcome Home)
How to send random text messages from a list
#48

Just testing this out and seems to be working well, thanks for your help!

But I can’t understand the santex for the announce in order to change it to my liking if i wanted to so something like this for arive how would i do it?

Welcome home ($name or $name and $name), ($name or $name and $name) (is or are) in the house! woop woop, woop woop!

from this:
(whoI == 1 ? ‘Welcome home ’ : ‘’) + (i > 0 ? left(who[whoI], i) + ’ and ’ + right(who[whoI], length(who[whoI]) - i - 2) : who[whoI]) + (whoI == 2 ? ’ has left the building!’ : ‘’)

Was thinking once i understood it would it be possible if it was set to on events from current place. you could announce when the person left and when they arrived at a new place?