Send iOS notification to receipient based on who triggered event

Tags: #<Tag:0x00007f739f3bdca0>

Hi,
I was wondering if there is a way to send a notification only to the person who triggered the event.

Example: I want to send the notification the alarm has been set only to the person who triggered it.

I have notifications working and can do that with actions in iOS:

  1. Created the action with name Alarm on in the companion app.
  2. Created the below automation:
- alias: "Turn alarm on"
  initial_state: true
  trigger:
    - platform: event
      event_type: ios.action_fired
      event_data:
        actionName: 'Alarm on'
  action:
    - service: input_boolean.turn_on
      entity_id: input_boolean.alarm
    - service: notify.mobile_app_rene_s_iphone_x
      data:
        message: 'Alarm turned on'

I could create a similar automation based on an action with a similar name, but would rather have the same automation, but notification to be sent to the source that sent the event …

Might be too complicated, but maybe someone has an idea?

Ever figure this out?

Nope, unfortunately not.

There may be a way now that ha records who does actions… but I am not yet familiar with the functions of that feature…
In the meantime… you could use state-switch based on which user… and have it only show a user specific button/interface… so the action could be tied to which user pressed it? Is it a keypad or just a button press?

Managed to get ti working.

Example below

automation

 - id: '1599917976096'
   alias: Check Lock Status
   description: ''
   trigger:
   - platform: event
     event_type: ios.action_fired
     event_data:
       actionName: Check Locks
   condition: []
   action:
     service: script.home_is_secure_check_notify
     data:
       sourceDeviceID: >-
         {{ trigger.event.as_dict()['data']['sourceDeviceID']}}
   mode: single

script


home_is_secure_check_notify:
  alias: Lock Status
  icon: mdi:lock
  mode: single
  sequence:
    - service_template: >
        {% if sourceDeviceID | length > 0  %}
          notify.mobile_app_{{ sourceDeviceID }}
        {% else %}
          notify.mobile_app_lees_iphone
        {% endif %}
      data:
        title: Windows & Doors
        message: >
          {% if is_state("binary_sensor.housesecure", "off") -%} All windows and doors are shut {%- else -%} The following are open! {% for each in expand('group.all_openings') if each.state in ('unlocked','open','on') %}{{ each.name }} {%- if not loop.last %}, {% endif -%} {% endfor %} {%- endif %}.

Here I am using {{ trigger.event.as_dict()[‘data’][‘sourceDeviceID’]}} to get the device id that that triggered the automation