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’

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…”

1 Like

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
1 Like

Thanks! it’s OK now :slight_smile: