What are you using to determine presence? (the HA app, motion sensor, ping (the phone) sensor…).
I don’t do a nobody is home, I do it room by room since I have motion sensor in each room. I do have automations that look to see if any motion sensor has ‘not’ had motion in x minutes.
This depends on what you are using to establish presence to be honest.
But assuming it’s a tracker device of some sort then I would simply create groups in yaml.
So for example we all have our own trackers individually but also have created a group for mine and the Mrs tracker and similarly for the kids. You could also create a group containing all people / trackers and then simply use the group home or not_home for x amount of time as a trigger for what ever you like.
You can create as many groups as you want.
Unless you need or want a timer etc but to be honest HA is able to tell you when the group last changed state anyway.
I’m amazed over and over how straight forward HA is compared to Homey. It is more and more obvious that Homey is far from complete to be a home automation system. It lacks these sort of things. You can solve most of the things but its just complicated.
Create a script “Everyone is away” where I adjust my lights and devices for “away mode”.
Create an animation that triggers on when everyone is away (group of trackers) with a delay for 5 minutes before calling the script “Everyone is away”.
Next is to create an animation that triggers if someone comes home before these 5 minutes delay has ticked down to zero, to abort the countdown. I think I can do that with homeassistant.turn_off if I have understood it correctly.
Just set the trigger for the automation to:
state of the group is not_home for x mins.
That way you don’t need to worry about a timer or if someone comes back within 5 mins, it simply won’t trigger the scene unless the group is away for how ever long you require.