Combining IOS notifications [HA FIX Needed!]

SEE UPDATE ON CURRENT PROBLEM… please scroll down…

Hi All

I have managed to get IOS notification working with a action (Close garage door)
And I have a live snapshot that is also working

BUT I cant seem to combine the two push notifications?

# Garageport IOS Notification
  - alias: Notify IOS garageport is open
    initial_state: true
    hide_entity: true
    trigger:
      - platform: state
        entity_id: cover.sonoff_sv_garage
        from: 'closed'
        to: 'open'
    action:
      - service: notify.ios_group_caspersen_home
        data:
          title: "Garageport status"
          message: "Garageporten er åben {{ states('sensor.time') }}"
          data:
            push:
              sound: "US-EN-Daisy-Garage-Door-Open.wav"
              badge: 0 ## This will remove the badge/app icon number ##
              category: 'garage1'
            data:
              attachment:
                content-type: jpeg
              push:
                category: camera
              entity_id: camera.axis_m1031w15 

This is the part that is causing me trouble having two catagory’s and two push commands:

data:
attachment:
content-type: jpeg
push:
category: camera
entity_id: camera.axis_m1031w15

Or is it in the IOS section I need to add the picture feed?

## IOS APP
ios:
  push:
    categories:
      - name: garageport
        identifier: 'garage1'
        actions:
          - identifier: 'CLOSE_GARAGEPORT'  ## This must point to an action ##
            title: 'Vil du Lukke Garageporten?'
            activationMode: 'background'
            authenticationRequired: yes
            destructive: no
            behavior: 'default'

I tried creating two service calls but this doesn’t work either?

# Garageport IOS Notification
  - alias: Notify IOS garageport is open
    initial_state: true
    hide_entity: true
    trigger:
      - platform: state
        entity_id: cover.sonoff_sv_garage
        from: 'closed'
        to: 'open'
    action:
      - service: notify.ios_group_caspersen_home
        data:
          attachment:
            content-type: jpeg
          push:
            category: camera
          entity_id: camera.axis_m1031w15 
      - service: notify.ios_group_caspersen_home
        data:
          title: "Garageport status"
          message: "Garageporten er åben {{ states('sensor.time') }}"
          data:
            push:
              sound: "US-EN-Daisy-Garage-Door-Open.wav"
              badge: 0 ## This will remove the badge/app icon number ##
              category: 'garage1'
      - service: camera.snapshot 
        data:
          entity_id: camera.axis_m1031w15
          filename: '/config/tmp/axis_m1031w15_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'

So close now…

I get this error

Log Details (ERROR)

Sun Oct 21 2018 17:57:33 GMT+0200 (Central European Summer Time)

Invalid service data for notify.ios_group_caspersen_home: extra keys not allowed @ data[‘attachment’]. Got OrderedDict([(‘content-type’, ‘jpeg’)]) extra keys not allowed @ data[‘entity_id’]. Got ‘camera.axis_m1031w15’ extra keys not allowed @ data[‘push’]. Got OrderedDict([(‘category’, ‘camera’)]) required key not provided @ data[‘message’]. Got None

Using this for IOS:

## IOS APP
ios:
  push:
    categories:
      - name: garageport
#        identifier: 'garage1'
        identifier: 'camera'
        actions:
          - identifier: 'CLOSE_GARAGEPORT'  ## This must point to an action ##
            title: 'Vil du Lukke Garageporten?'
            activationMode: 'background'
            authenticationRequired: yes
            destructive: no
            behavior: 'default'

And this for Action:

# Garageport IOS Notification
  - alias: Notify IOS garageport is open
    initial_state: true
    hide_entity: true
    trigger:
      - platform: state
        entity_id: cover.sonoff_sv_garage
        from: 'closed'
        to: 'open'
    action:
      - service: notify.ios_group_caspersen_home
        data:
          attachment:
            content-type: jpeg
          push:
            category: 'camera'
          entity_id: camera.axis_m1031w15       
      - service: notify.ios_group_caspersen_home
        data:
          title: "Garageport status"
          message: "Garageporten er åben {{ states('sensor.time') }}"
          data:
            push:
              sound: "US-EN-Daisy-Garage-Door-Open.wav"
              badge: 0 ## This will remove the badge/app icon number ##
#              category: 'garage1'
              category: 'camera'
# # Snapshot placed in tmp folder when IOS notification is called
      - service: camera.snapshot 
        data:
          entity_id: camera.axis_m1031w15
          filename: '/config/tmp/axis_m1031w15_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'
1 Like

[99% SOLVED]

UPDATE: This makes it impossible to have two notifications showing snapshots calling them all camera creates the same IOS action under the snapshot! - There must be a way to create two notification and not having to use identifier/category “camera” just to get the feed?

How can I add example:
  - name: garagemotion
    identifier: 'garagemotion'
    actions:
      - identifier: 'GARAGEMOTION'
        title: 'Garage motion'
        activationMode: 'background'
        authenticationRequired: no
        destructive: yes
        behavior: 'default'

and still get the “camera” snapshot from the same camera but in another notification?

After much trial and error I found that the category needs to be “camera” in order for the snapshot to work?
(If anyone have a better solution then let me know!)

## IOS APP
ios:
  push:
    categories:
      - name: garageport
        identifier: 'camera'
        actions:
          - identifier: 'CLOSE_GARAGEPORT'  ## This must point to an action ##
            title: 'Tryk her for at Lukke Garageporten?'
            activationMode: 'background'
            authenticationRequired: yes
            destructive: no
            behavior: 'default'


# Garageport IOS Notification
  - alias: Notify IOS garageport is open
    initial_state: true
    hide_entity: true
    trigger:
      - platform: state
        entity_id: cover.sonoff_sv_garage
        from: 'closed'
        to: 'open'
    action:
      - service: notify.ios_group_caspersen_home
        data:
          attachment:
            content-type: jpeg
          push:
            category: 'camera'
          entity_id: camera.axis_m1031w15       
      - service: notify.ios_group_caspersen_home
        data:
          title: "Garageport status"
          message: "Garageporten er åben {{ states('sensor.time') }}"
          data:
            push:
              sound: "US-EN-Daisy-Garage-Door-Open.wav"
              badge: 0 ## This will remove the badge/app icon number ##
              category: 'camera'
            entity_id: camera.axis_m1031w15

You need to store a snapshot locally and send a link to the image with the notification. The link to the file has to be accessible from outside the network, like this:

  action:
  - service: camera.snapshot
    data:
      entity_id: camera.front
      filename: '/config/www/doorbell.jpg'
  - service: notify.all_ios_devices
    data:
      message: Someone has pressed the doorbell.
      data:
        push:
          sound: "Doorbell.wav"
        attachment:
          url: https://[domain_name].duckdns.org/local/doorbell.jpg

Note the two different paths to the file location.

1 Like

@tom_l Thanks but that’s not the problem… I have live feed working without local accessible to a snapshot folder and it works great
@Charles_Brown I looked at your examples and thought that you might be able to share some light on my problem?
@robbiet480 I used your excellent youtube video to create this notification, but I haven’t been able to find any way to split it up into multiple notification since it requires the category “camera” to be used, I keep getting the same action below each notification?

The one to the left is ok - Garageport open and action to close the port
The one to the right is wrong should be without any action to close the garageport

I want the same camera to show the live feed in both two scenarios

1. Motion detection
2. Garage opening with IOS action to close it again?

My challenge is that no matter what I try to do I keep getting the action to close the garage door.
And that is really bad because that would open the door if pushed when motion detection triggers.
But I need the “camera” category/identifier under IOS settings which interfers with my secound notification?

ios:
  push:
    categories:
      - name: garageport
        identifier: 'camera'
        actions:
          - identifier: 'CLOSE_GARAGEPORT'  ## This must point to an action ##
            title: 'Tryk her for at Lukke Garageporten?'
            activationMode: 'background'
            authenticationRequired: yes
            destructive: no
            behavior: 'default'

Then the action:

# Garageport IOS ACTION
  - alias: iOS app notification action garage1
    initial_state: true
    hide_entity: true
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: CLOSE_GARAGEPORT
    action:
      - service: cover.close_cover
        entity_id: cover.sonoff_sv_garage

Then the IOS notification:

# Garageport IOS Notification
  - alias: Notify IOS garageport is open
    initial_state: true
    hide_entity: true
    trigger:
      - platform: state
        entity_id: cover.sonoff_sv_garage
        from: 'closed'
        to: 'open'
    action:
      - service: notify.ios_group_caspersen_home
        data:
          attachment:
            content-type: jpeg
          push:
            category: 'camera'
          entity_id: camera.axis_m1031w15       
      - service: notify.ios_group_caspersen_home
        data:
          title: "Garageport status"
          message: "Garageporten er åben {{ states('sensor.time') }}"
          data:
            push:
              sound: "US-EN-Daisy-Garage-Door-Open.wav" ## Sound files: https://www.home-assistant.io/docs/ecosystem/ios/notifications/sounds/
              badge: 0 ## This will remove the badge/app icon number ##
              category: 'camera'
            entity_id: camera.axis_m1031w15

And finally the second Motion notification:

# Automations notification for Garage if Nobodys home 
  - alias: Garage movement
    hide_entity: true
    initial_state: 'on'
    trigger:
    - platform: state
      entity_id: binary_sensor.garage_entry
      to: 'on'
    - platform: state
      entity_id: binary_sensor.garage_motion
      to: 'on'
    action:
      - service: notify.ios_group_caspersen_home
        data:
          message: "Der er aktivitet i garagen? {{ states('sensor.time') }}"
          title: "Home Assistant"
          data:
            attachment:
              content-type: jpeg
            push:
              sound: "US-EN-Alexa-Motion-In-Garage.wav"              
              category: 'camera'
            entity_id: camera.axis_m1031w15

As you can see the category ‘camera’ is used every time to get the live feed…
But if I change it to ‘garage1’ the livefeed dosent work, and I really don’t want the snapshot setup

All help to clear this up would be much appreciated

Regards
Casperse

Looks like its a known problem in HA?

Yes, I think. I have not revisited the problem, so don’t know for sure if, for newer iOS versions, this can be done. I think @robbiet480 is the person who can be sure what the actual capabilities are.

Lack of parametrisable actions was the reason why I turned out to Telegram notifications, handling actions with a bot, but iOS notifications are prettier, it’s a shame the interface is not easier

@robbiet480 Hi Robbie any news about this functionality? - Two different IOS notifications with two different pictures from different cameras?

(Also my IOS notification was broken after the last two updates (My configuration above is still the same) is there any change that you are aware off to get it working again? - Really missing the notification alerts when some one opend the garagedoor) Thanks for your hard work this is a great feature!