Notify only people who are home

I’ve found a lot of pieces, but I can’t seem to put the puzzle together. For several automations I’m looking for a way to notify only the people who are home, unless nobody is home and everybody should get the notification. I’ve been looking into scripts and templates, but I can’t seem to find a fitting solution. Does anybody have a suggestion how to tackle this challenge? Thx!

Id either look into making a lot of notify groups then using templates to choose which group to notify… or writing a python or appdaemon script for this