I am trying to create an advanced flow which only performs the action when the last person comes home. This is because only at this moment I want to activate the security flows.
I can find the following options:
IF
First person comes home
Last person leaves
Some comes home
Specific person comes home
AND
Specific person is at home
Nobody is home (which becomes some is at home when you turn it around instead of everybody is at home what I expected)
So these do not enable what I want.
IF some comes home
AND everybody is at home
Sorry first person comes home I mean. Read it to quickly . Ignore my post
But you could make a number variable. Every time someone comes home +1. And if someone leaves home -1. And id you for example have 4 people in a household do something when the variable is 4.
// Test everyone Home
var users = await Homey.users.getUsers();
for (const user of Object.values( users ) ) {
// log( "User", user.name )
if (user.enabled & ! user.present ) {return false}
};
return true;