Arrival of people including multiple people at once


#61

emma? … not steven? ahh … its a pseudo name. :wink:

i will leave the is part for you to figure out. :slight_smile:


#62

no its the wife :blush:

ok will give it ago :slight_smile: helps me learn :+1:


#63

I haven’t worked it out yet, but I’m determined to do it! So untill tomorrow I’ve gone back to the other one.
But it just shows how much doing stuff like this, you learn and improve so thank you @bangali for your help/ wisdom. I really appreciate the time you give to us all.

Look how much I cleaned up my previous code without even looking at it much! It was about 14 chunks now about 9.


#64

please use the on event block for the presence sensors otherwise the else block for it will unnecessarily process the presence event.


#65

Yes am planning to this is the old pistion you did that I added the else for departure. But your new one is much more streamlined and smooth but because I’ve been messing round with the code I didn’t get chance to finish it. So paused it until I finish the new one tonight :slight_smile:


#66

I am using this piston at the moment for people arriving thanks to @bangali. However, yesterday I came home and then my hubbie arrived about 5 minutes later. I got the push notification that I was home and then I got a notification the Tom and Tom had arrived. My speakers also greeted me and then greeted my hubbie with Tom and Tom again. Can someone shine some light on the timing for this piston? What does line 24 represent?


#67

likely because ST detected toms presence sensor as he was approaching then disconnected and again detected his presence as he got closer.


#68

Thank you, but I am new to Webcore. This Piston is but much for me to digest. Seems my needs are much simpler, I have one person arriving, then open the garage and turn on the lights, and announce welcome home. It almost works as is…the last IF with the announcement has been the problem.


#69

I’m guessing i can’t do this then?

(i > 0 ? left(who[whoI], i) + ’ and ’ + right(who[whoI], length(who[whoI]) - i - 2) + (if(whoI == 2,(’ are’ : who[whoI] + ’ is’),’’)))


#70

thats too complicated for me :slight_smile:

what are you doing there?


#71

So based on your santex

But I only want ’ are’ : who[whoI] + ’ is ’ to evaluate if someone is arriving otherwise ‘’ (no text)

So I tried a few ways but couldn’t get it to evaluate as a string instead it now says false


#72

ahh … ok.

it should only add the are or is if there are names in the list otherwise it shouldnt be adding either of those. is that not happening correctly?


#73

What’s its doing is this

Goodbye Steven is Steven is has left the building. Or goodbye Steven and Emma are Steven and Emma are has left the building

For the departure then for arrival

Welcome home Steven is Steven is in the building. Or welcome home Steven and Emma are Steven and Emma are in the building.

So I’m trying to work out how to capture just the name/ name’s on there own. But first I’m trying to make it so the is / are evaluation is only added and happens on the arrive equation.

Hence why I tried if whole ==2 then do the equation if not don’t but it didn’t like that :thinking:


#74

(i > 0 ? left(who[whoI], i) + ’ and ’ + right(who[whoI], length(who[whoI]) - i - 2) + (whoI == 2 ? ’ are’ : ‘’) : who[whoI] + (whoI == 2 ? ’ is’ : ‘’))


#75

Thanks, I’m trying to learn so can you explain why . What does the ? Do and :


#76

https://wiki.webcore.co/Expressions#Ternary_operator_.28_c_.3F_t_:f.29


#77

BOOOM thank you @bangali ! After more playing I have got it working perfectly. I have added another variable to make it easier to right the text you want, as well as a push variable so you can say something different on the messages to the speaker. @pcgirl65 if you import this instead and change the words and add your GET this should fix your issue.

I have the speaker set to only play during certain modes as well so that it doesn’t shout after 10pm and before 8 am (my night mode) but still pushes a notification. It also doesn’t speak if noone is there to hear it ie in away mode. So just add the modes you want it to speak in.

Only thing left to do now is to take it one step further and announce where the people have gone using the webCore presence sensor. :grin:


#78

Thanks for keeping at this! Much too complicated for me! I will import and give it a go.


#79

So is the “announce” variable for the text you want to speak? If so, could I set it as a GET request with a random statement?


#80

Yes and yes the names variable is who came home or left so if there is one it just says there name, if there is 2 it say X and y and more than 3 X, y and z. So just add that too your string or random comments.

Then if you want the correct grammar after the name the nameIsAre does that, so on arrive it will say X is or X and y are or X, Y and Z are ( in the house) and on depart it will say X has or X and Y have or X, Y and Z have ( left the house). That make sense?

I’ll work on a random part to it later when I get it ready to make it easier to import, then it will do it all for you and you just put the variable anounce in the your GET