iOS actionable notification with camera image attached

Thanks.

I had done that and the reboot dance many times… and this time, after at least 50 tries, it worked.

Cheers!

Would you mind sharing the applicable parts of your config J0dan? I’m also having issues, I can’t get the camera (ffmpeg) to display at all.

Here’s my config for working actionable notifications and camera feed…

Automation:

  - alias: 'Garage door still open'
    initial_state: on
    trigger:
      platform: state
      entity_id: cover.myq_garage_door_opener
      from: 'closed'
      to: 'open'
    action:
      service: script.turn_on
      entity_id: script.garage_door_alarm

  - alias: 'Garage door closed'
    initial_state: on
    trigger:
      platform: state
      entity_id: cover.myq_garage_door_opener
      from: 'open'
      to: 'closed'
    action:
      service: script.turn_off
      entity_id: script.garage_door_alarm

  - alias: 'Open Garage Door'
    initial_state: on
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: OPEN_GARAGE_DOOR
    action:
      service: cover.open_cover
      entity_id: cover.myq_garage_door_opener

  - alias: 'Close Garage Door'
    initial_state: on
    trigger:
      platform: event
      event_type: ios.notification_action_fired
      event_data:
        actionName: CLOSE_GARAGE_DOOR
    action:
      service: cover.close_cover
      entity_id: cover.myq_garage_door_opener

Script (you could do this all in the automation but I separate it because I use the cancel automation if the door closes before 15 minutes:

  garage_door_alarm:
    alias: "Garage door alarm"
    sequence:
      - delay:
          minutes: 15
      - service: notify.all_ios
        data:
          message: "Garage Door is Open"
          data:
            push:
              badge: 0
              sound: "US-EN-Alexa-Garage-Door-Opened.wav"
              category: camera
            entity_id: camera.garage

iOS:

  push:
    categories:
      - name: camera
        identifier: 'camera'
        actions:
          - identifier: 'OPEN_GARAGE_DOOR'
            title: 'Open Garage Door'
            activationMode: 'background'
            authenticationRequired: no
            destructive: no
            behavior: 'default'
          - identifier: 'CLOSE_GARAGE_DOOR'
            title: 'Close Garage Door'
            activationMode: 'background'
            authenticationRequired: no
            destructive: yes
            behavior: 'default'
2 Likes

Thanks - I think I’ve solved my problem and have it working, just not how I’d really want it to.

I was using everything the same, with the only difference was I assumed the identifier/category was arbitrary, it seems unless it is set to exactly ‘camera’ it won’t work.

Does this mean I can only pair any camera feed with a single pair of actions/buttons? I can set separate cameras to work with different notifications by setting entity_id under data. But because the identifier has to be ‘camera’, my buttons (and hence actions) will always be the same regardless of the camera feed.

An example of what I’d like to do is:

  1. Have the doorbell fire a notification with the front door camera feed, with options to either ignore, or play a message/sound.
  2. Have motion sensors fire a notification with a camera feed from that area, with options to either ignore, or fire an alarm.

Is that possible?

@mynameisdaniel Yeah it’s kind of restrictive. So the way it works is you can only set up one set of actionable notifications. You can change the camera though. Hopefully this changes at some point.

I made an all in one automation for this.

I need help with this…
I’m able to have an iOS notification with the camera feed (live) but the point is to have the image of when the notification occurs (live feed shows me when I look at it, not when the notification occurred)

This is my existing functional automation (live feed). All I have is the full url of the camera feed (with authentication, etc…) but how do I make HA take an actual image from it and push it?

- id: '1522174458955'
  alias: Notification "intrusion detection" entrée
  trigger:
  - entity_id: binary_sensor.sfnetwork_nvr_field_detection_4
    from: 'off'
    platform: state
    to: 'on'
  condition:
  - after: 07:00:00
    before: '20:00:00'
    condition: time
  action:
  - data:
      data:
        entity_id: camera.ext_entree_maison
        push:
          category: camera
      message: Mouvement à l'entrée de maison!!!
      title: Home Assistant - Cam Entrée
    service: notify.ios_sfiphone_7_plus
  - data:
      delay: 00:00:05
      message: Attention, mouvement détecté à l'entrée!
      sonos_entity: media_player.bureau
      volume: '0.3'
    service: script.sonos_say

Finally I found this thread, and looks like its exactly the same problem I have been struggling with?

"So currently its not possible to get two different camera notification without getting the same action button?
@mynameisdaniel Did you find a way to pair camera feed with different or no action buttons?

No, I haven’t found a way to this - I have been keeping an eye on changes, but haven’t seen anything around this.

@mynameisdaniel Bummor… Do you know if this has been reported to the HA dev team?

Hi,

I have the same problem, i can’t use different actions buttons for differents ‘camera’ category.

Has anyone gotten around this, using more cameras?

I’ve been messing around with this the last few days, it appears you can use different cameras but you have to lump all different automation inside the one single actionable notification.

DrZzs talks about it here: https://www.youtube.com/watch?v=x8SpN-PlBiM

All, in case you’re still wondering, this is possible. @robbiet480 just let me know that camera, camera1, camera2, camera3, camera4, and camera5 all all valid categories; each can have its own list of actions.

Incidentally, the same is true for map categories.

Rejoice!

I just tried to add camera1 as an identifier in the app but it won’t accept numbers.

is this a good code for actionable notification with an snapshot?

     - service: notify.mobile_app_iphone
       data:
         title: 'Garage Door'
         message: 'The garage door has been open for more than 30 minutes!'
         data:
           push:
             category: "garage_buttons"
             sound: US-EN-Daisy-Front-Door-Motion.wav
           action_data:
             entity_id: cover.sonoff_sv_garage
           attachment:
             url: "http://192.168.1.6:8123/local/cameragarage2.jpg"
             content-type: jpeg
             hide-thumbnail: false

dear @bachya,

I’m trying to do exactly what you describe here: to use different camera live streams with different actionable notificatons, and I was very happy to see your comment about using camera1, camera2, etc, but I’m still struggling to make it work, I fail to define the camera entitiy itself. Do you happen to know how to use it properly?

Here’s what I did so far:

  • define two different camera push categories in configuration, first as camera, with one action button,
  • second is camera1, with two different action button
  • I have the neccessary automations for notification_fire, they all work properly

I’m testing camera1 category with developer tool, by calling notify service to my phone, and pasting in the automation part for the notification itself, which, btw also contains a snapshot image as attachment.

What I achieve: I receive the notification to my phone, snapshot is attached, thumbnail visible, upon notification longpress to open the notification in bigger size to view the live camera feed I get the two action buttons that I need, but get no camera feed, and in the placeholder of the camera stream I get No entity_id found in payload! error message.

I think it relates to the camera entity, and this makes me wonder how to specify the camera entity itself in the automation part? As camera? As camera1? no entyty type reference? :slight_smile:

Here’s the automation I’m trying to run:

title: Doorbell was pressed!
message: You can open the two different gates with the below buttons
data:
  push:
    sound:
      name: dahua_doorbell.wav
      critical: 1
    category: camera1
    entity_id: camera.street
  attachment:
    url: 'http://XXXXXX/local/camera_street.jpg'
    content-type: jpg
    hide-thumbnail: false

no matter how I try to reference my camera itself, it doesn’t work, I always end up with No entity_id found in payload! error message.

I tried so far:

  • entity_id: camera.street
  • entity_id: camera1.street
  • entity_id: street

in case you needed, here’s ios part from configuration:

ios:
  push:
    categories:
      - name: Camera stream with one button
        identifier: 'camera'
        actions:
          - identifier: 'CLOSE_GATE'
            title: 'Close the gate'
            activationMode: 'background'
            authenticationRequired: no
            destructive: yes
            behavior: 'default'
      - name: Camera stream with two buttons
        identifier: 'camera1'
        actions:
          - identifier: 'OPEN_GATE'
            title: 'Open gate'
            activationMode: 'background'
            authenticationRequired: no
            destructive: yes
            behavior: 'default'
          - identifier: 'OPEN_SMALLGATE'
            title: 'Open small gate'
            activationMode: 'background'
            authenticationRequired: no
            destructive: no
            behavior: 'default'

and the corresponding automation for action notification fire:

- alias: MobileApp push notif action button for gate opening
  initial_state: true
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: OPEN_GATE
  action:
  - service: cover.open_cover
    entity_id: cover.gate
- alias: MobileApp push notif action for small gate opening
  initial_state: true
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: OPEN_SMALLGATE
  action:
  - service: switch.turn_on
    entity_id: switch.dahua_gate_open

I would be very very thankful if someone could enlighten me how to properly set up different notifications with different action buttons with camera stream entities…

1 Like

Hi.

I’m not shure that what you want to do is possible.
Dr Dzzs said in this video that “camera” is a “magic key word” to tell Home assistant to bind this action to a “camera entity”

Home assistant should have to evolve to take in consideration multiple camera#x identifiers

If I’m wrong I’ll be glade to know it :slight_smile:

Regards,
Jeff

That is possible according the doc’s → Dynamic attachments | Home Assistant Companion Docs.
A total of 5 cameras should be supported.

I too am running into the issue of the iOS app will not take CAMERA1 as an identifier since it contains a Number