Ever wanted to set up something like dynamic notification groups in Home Assistant? Perhaps your partner wants notifications only between 1700 and 2300 while you want to get them around the clock? And if you have kids with smart phones, perhaps there are some notifications they should see between 1400 and 2000, or just in the weekends?
I will show you how you can combine a script with some helper entities and the Scheduler component to bring it to life.
First we need to add 1 toggle for each house member / device. We can use the toggle manually in the user interface to pause notifications, or as we will show later, through a schedule.
Head over to Configuration → Helpers → Click Add Helper. Choose Toggle and give it a name like Raymond notifications and an icon like mdi:bell
Create one of these for each house member or device. Take note of their entity ids, they will be something like input_boolean.raymond_notifications
In order to have a reusable notify service we will make a script that contains all the logic.
Since we want to be able to pause notifications per house member we need a script with 1 branch of logic for each member. This will use somewhat advanced script features in Home Assistant. We will be using the choose action to create these branches.
The syntax for the choose actions can seem a bit wild, but if you base your setup on this you don't need to think too much about it.
Now you need to replace all your instances of notify actions in automations that should notify the family with a service call to the script.
Here is an example automation, my probably most acted upon automation 😅
As you can see the service call to the script looks very similar to a regular notify action.
Congratulations 🎉 You aleady have a notification systems that allows you to disable notifications for a house member through the user interface.
In order to have schedules for when notifications are on/off for a house member we can turn to the Scheduler component by Niels Faber.
Follow the install instructions to set up the scheduler component + card using HACS. Then you need to make sure you have a Lovelace card configuration like this to enable editing these schedules:
With this in place you can now set up as many schedules as you like. And you can still override the current value using the user interface if you need to.