Notify multiple iOS devices

I am working on an automation to push a message out to multiple iOS devices. Any ideas of how to consolidate the code? I currently have…

action:

  • service: notify.ios_PHONE1_NAME
    data:
    message: ‘Message’
  • service: notify.ios_PHONE2_NAME
    data:
    message: ‘Message’
1 Like

create a notify group, then call the notify service on the group.

Yep That’s the way to do it. In your notify: section of your configuration:

- platform: group
  name: all_ios_devices
  services:
    - service: ios_ipad
    - service: ios_iphonex
    - service: ios_ipad_pro

I’m trying to do this by creating a group but my config check says - Invalid config for [group]: [services] is an invalid option for [group]. Check: group->group->notify_family->services.
In my groups.yaml I have:

notify_family:
  name: Notify Family
  services:
    - service: notify.mobile_app_jeff_welvaerts_iphone
    - service: notify.mobile_app_lygea_s_iphone

Can you shed some light on what I’m doing wrong?

The last comment said to add his snippet to the notify section of configuration.yaml.

You’ve added your bit to groups.yaml.

Thanks. I added this to my configuration but the notification doesn’t work. In my config:

notify:
  - platform: group
    name: all_ios_devices
    services:
      - service: ios_jeff_iphone
      - service: ios_lygea_s_iphone

My automation:

- alias: Shed Door Has Been Unlocked By Jeff
  initial_state: true
  trigger:
    platform: state
    entity_id: sensor.kwikset_touchpad_electronic_deadbolt_status
    to: Unlocked with Keypad by user 1
  action:
    - service: notify.all_ios_devices
      data: 
        message: "Jeff Unlocked The Shed Door"
        data: 
          push: 
            sound: default 

If I use notify.mobile_app_jeff_iphone and/or notify.mobile_app_lygea_s_iphone the notification works fine but using notify.all_ios_devices produces no notification to either device.

My guess is I have the service incorrect? I tried removing the ios in the notify service but got the same result.

Since the beta 2.0 it has changed slightly, try this notification group:

- platform: group
  name: all_ios_devices
  services:
    - service: mobile_app_jeff_iphone
    - service: mobile_app_lygea_s_iphone

it’s now “mobile_app…” instead of “ios…”

2 Likes

I’m using v1.5 of the iOS Companion app with HA 0.98. I’ve created a notify group and send a test message using the services tool in the dev section. The notification went to both iOS devices.

The only difference is I dropped the second data field.

As suggested, if sending a notification to notify.mobile_app_jeff_iphone works, you should probably modify the notify group so that it looks like @tom_l’s suggestion:

If that doesn’t work, I would simplify the automation and only include the message field for the notification:

- alias: Shed Door Has Been Unlocked By Jeff
  initial_state: true
  trigger:
    platform: state
    entity_id: sensor.kwikset_touchpad_electronic_deadbolt_status
    to: Unlocked with Keypad by user 1
  action:
    - service: notify.all_ios_devices
      data: 
        message: "Jeff Unlocked The Shed Door"

This worked. Thank you.

That’s a nice way of doing it by adding the services to a group.

I’m currently trying to do something similar, and have automation that add and remove devices from the group.

Easier said than done however!

hi @tom_l where you put this code? Thanks

Under notify:

In my particular case, because I have many notification methods, I use

notify: !include notifications.yaml

Then the contents of notifications.yaml:

- platform: group
  name: all_ios_devices
  services:
  - service: mobile_app_iphonex
  - service: mobile_app_ipad_pro

- platform: kodi
  host: 10.1.1.14
  port: 8080
  username: !secret kodi_user
  password: !secret kodi_password
  name: kodi_lounge_osmc

- platform: kodi
  host: 10.1.1.3
  port: 8080
  username: !secret kodi_user
  password: !secret kodi_password
  name: kodi_cinema_htpc

- platform: smtp
  name: email
  server: !secret email_server
  port: 25
  timeout: 15
  sender: !secret email_sender
  encryption: none
  recipient: !secret email_receiver
  sender_name: !secret email_name

- platform: telegram
  name: telegram_general
  chat_id: !secret telegram_general_chat_group_id

- platform: telegram
  name: telegram_system
  chat_id: !secret telegram_system_chat_group_id

# - name: test_file_notify
#   platform: file
#   filename: /config/file_notify.txt
#   timestamp: true
4 Likes

Thanks! it’s OK now :slight_smile:

1 Like

Hi,
I did it exactly the same way with notification.yaml

- platform: group
  name: Известие до родители
  services:
  - service: notify_mobile_app_tosho_a71
  - service: notify_mobile_app_vessy_s7

and configuration check is okay. But when I try to send message it nothing happen.
When I use notification to each phone separate , it is work.
Can you advise me ?

Why i have to use _ instead .
when I put in my notification.yaml
service: notify.mobile_app_tosho_a71
it give me error, to change to notify_mobile_app_tosho_a71

I fix it. Just emove notify.********

1 Like

Trying to do something similar but can’t get it to work with a test automation. I added this to my configuration file…

notify: !include notifications.yaml

This is within the notifications.yaml file…

- platform: group
  name: mike_mary
  services:
  - service: mobile_app_marys_iphone
  - service: mobile_app_mikes_iphone

And finally, this is my test automation…

alias: Test Groups
description: ''
trigger:
  - platform: device
    type: turned_on
    device_id: 08208e0216aa0fe7463894fb17b2e2c0
    entity_id: switch.downstairs_hallway_lights
    domain: switch
condition: []
action:
  - service: notify.mike_mary
    data:
      message: Test
mode: single

Any suggestions? I am sure it’s something stupid I am missing.

You could try this in your notifications.yaml instead:


- name: mike_mary
  platform: group
  services:
  - service: mobile_app_marys_iphone
  - service: mobile_app_mikes_iphone

That is identical. The order of items in YAML dictionaries is unimportant. Have a read of this: Thomas Lovén - YAML for Non-programmers

This is the same too:

- services:
  - service: mobile_app_marys_iphone
  - service: mobile_app_mikes_iphone
  name: mike_mary
  platform: group

Did you restart Home assistant after creating the notification group?

Any errors in your logs?

What happens if you trigger the automation manually?