Hi everyone, I have tons of automations that utilize push notifications to the Home Assistant companion app on my iPhone. I have now upgraded to a new iPhone but my push notifications seem to be “hard coded” to the old phone and nothing is coming to the new phone. It seems like I have to go into every single automation and change the service: notify.mobile_app_XXX
to the new phone. Is there any way to automate this? I can’t even find a way to filter which of my automations have this service call and checking every single one would take forever. Is there an easier way? Ideally I would like to change it so that the notifications are selectable by Home Assistant user instead of per device so that I don’t run into this issue again in the future.
I’d be inclined to rename the entity id of your old phone to something else, and rename the new one to match that of the automation. The all of your automations will just work.
Most text editors have a “find and replace text” option that can speed this up.
A way to avoid having to do this again in future is to use notify groups. Use the groups in your automations and scripts. That way you only have to change the individual members in one place (the group config). This is worthwhile even if the group only has one member.
https://www.home-assistant.io/integrations/group/#notify-groups
Thanks! I did come across the group idea in my searches but it looked confusing as I didn’t understand the syntax but with some testing, I figured it out.
In case anyone comes across this in the future, here is what I did:
- Edit configuration.yaml and add the following:
notify:
- platform: group
name: "All Phones"
services:
- service: mobile_app_XXXX
- service: mobile_app_YYYY
- Restart HA
- Edit automations.yaml
- Use the find and replace to find
service: notify.mobile_app_XXX
and replace withservice: notify.all_phones
Works great!
Thanks!