Hi,
First posting. Hope it works…
I have created a notify.ALL_DEVICES group in my configuration.yaml so my automations can notify all members of the group through the HA app. But now I would like the members to be able to turn off some of the notifications by adjusting if they are part of the group. Anyone know how to achieve this? I can easily set a variable/input_boolean that each HA app user can set true/false to indicate if they should or should not receive the notifications, but I do not know how to use them in the configuration.yaml.
Here is my configuration.yaml:
Hi there ,I think that it you should do this from automations and not with group platform. As far as i know template conditions to check the state of input_boolean cannot be used in config like this. I would have checked the state of input boolean in automations and carried out the notifications accordingly.
Yes but I have many automations and I created a group so I don’t have to clutter up my automations with tons of individual notifications to each one. It saves hundreds of lines in my automations to just call one service rather than multiple services each with its own data.
Is there an alternative way to do it in automations so I don’t have to repeat the code over and over?
well in that case you can create a script with these notifications and call this script from automations whenever you need to send the notifications. You can pass on the message as a variable. This should work for you.
No idea whether this would work, but it should be relatively easy to test.
Try using the group.set and group.remove services in the Developer Tools to add / remove entities on the fly and then test with a notification to the group.
If that works then you should be able to create a single automation to add / remove a notify entity from the group based on the appropriate trigger.
@sheminasalam I am not sure how to pass variables to scripts. Here’s an example of one of my simpler notifications. I cannot do this in a script as trigger would not be defined. It would be possible with variables but I am not familiar with the use of them in HA.
Okay, so I think I am getting beyond my current understanding of HA and Yaml. I only started in the last few months. I tried to read up on groups https://www.home-assistant.io/integrations/group/ but that seems to be different to the notify group I’ve created. group.set and the explanations given seem to be all about groups of entities but the notify group seems to be a group of services? I am a bit lost as to how use group.set to add additional recipients to the notify service.
Any help would be appreciated.
I think this is how it’s done looking at my older notes, but I’ve not done this for some time so have nothing to test…
This approach will of course get more complicated if you want to add in images and other capabilities depending on the type of phones you are notifying.
The only alternative I can think of is to create multiple notify groups for every combination, or perhaps use a choose action in each automation and send the notifications without using a notify group based on who has them enabled (example snippet below)
Either of these options may get messy and wordy over time.