Using iOS actionable notifications to launch alternate app

Also after your reminder of looking for the Url I did some more googling and apparently not all apps have one… please keep me updated if you have any luck finding it…

1 Like

Found it. Luckily, Unifi has a link. I’m posting my configs here to help anyone searching for this solution down the road. Just FYI, I’m using a doorbell camera as gate sentry device, vs. some legacy keypad, telephony, or camera system.

This is what does:
Upon a Unifi Protect G4 Doorbell press, an automation is triggered to send an iOS actionable notification. The doorbell press gets you a new notification in your iOS notification center. And a long press on that notification gets you:

  • A live feed from your camera. The Unfi Protect integration is required (available via HACS). Also, you could capture an image snap if you don’t want the live feed.
  • Two actionable buttons under the camera image. One triggers another automation. In my setup, it’s opening a MyQ cover that controls a gate. The other button will launch your iOS Unifi Protect app. This is kinda important as you’ll often need to use the microphone to communicate with the probably unwanted doorbell presser.

It’s nice having these features in one view as it saves a bunch of unnecessary manual app motions. And here are the related yaml files.

configuration.yaml (this is needed to make the actions available to the HA mobile app)

ios:
  actions:
    - name: GATEBELL
      label:
        text: "Open Gate"

automations.yaml (needed for the actionable notifications, plus automations that trigger events from the notifications button press).

- id: '1625806066488'
  alias: Notification - Gate Doorbell Press
  description: ''
  trigger:
  - platform: state
    entity_id: binary_sensor.doorbell_gate
    to: 'on'
  condition:
  action:
  - service: notify.mobile_app_yet_another_iphone
    data:
      message: Intruder Alert!
      data:
        url: unifi-protect://
        sound: US-EN-Morgan-Freeman-Someone-Is-Arriving.wav
        entity_id: camera.gate
        actions:
        - action: GATEBELL
          title: Open Gate
        - action: PROTECT
          title: Launch Protect App
          url: unifi-protect://
  mode: single

- id: '1635694156078'
  alias: Notification - Gate Open Action
  description: Open the Gate from actionable notification
  trigger:
  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: GATEBELL
  condition: []
  action:
  - device_id: 47e45379341830b6eee84fed8a31cdb9
    domain: cover
    entity_id: cover.gate
    type: open
  - service: notify.mobile_app_yet_another_iphone
    data:
      message: Gate is Opening
  mode: single

There may be other methods to do something similar, but the above is working for me.

6 Likes

Awesome glad you found it. How did you end up finding it?

On the Protect support forum, hosted by the vendor. It looks like this info has only been known for a few months. Thanks a bunch for getting me there!

I am struggling with having a camera stream in my actionable notifications since days.

it does work with a still image from my unifi camera but it doesn’t work with providing a stream.
What’s the purpose of the first line with url: unifi-protect:// ?
Or is it a placeholder for your camera stream?

Hi. The first URL statement lets a press on the actual iOS notification launch Unifi Protect instead of the default HA companion app. Under the “data” section of the automation YAML, you’ll need to point to the actual camera entity in HA to get an active feed from the camera. In my setup, I think it’s only getting 1 or 2 frames per second from the camera in this mode, so I guess it’s not exactly live. But it’s good enough to see what’s going on.

I know this is probably stating the obvious, but the Protect integration via the HACS store is needed to get this working. I wish our friends at HA would do a native integration. I only mention the integration as I suppose there are a variety of automations where you’d want to grab an image snap via a URL without the need of leveraging the the integrated entity.

Hope that helps.

I just realized that you’re using an iphone while I am trying to get this working on a Pixel Android phone. :see_no_evil:

using a still image does work:

service: notify.mobile_app_pixel_4
data:
  title: Unifi Protect Alarm
  message: motion detected by {{ trigger.id }}
  data:
    image: http://192.168.50.26/snap.jpeg
    ttl: 0
    priority: high
    importance: high
    actions:
      - action: URI
        title: HA Cams
        uri: /lovelace-security/cams
      - action: URI
        title: HA Security
        uri: /lovelace-security/home
      - action: URI
        title: Unifi Protect
        uri: app://com.ubnt.unifi.protect

trying to use the entity of this protect camera as a stream unfortunately doesn’t:

service: notify.mobile_app_pixel_4
data:
  title: Unifi Protect Alarm
  message: motion detected by {{ trigger.id }}
  data:
    entity_id: camera.livingroom
    ttl: 0
    priority: high
    importance: high
    actions:
      - action: URI
        title: HA Cams
        uri: /lovelace-security/cams
      - action: URI
        title: HA Security
        uri: /lovelace-security/home
      - action: URI
        title: Unifi Protect
        uri: app://com.ubnt.unifi.protect

maybe it’s an android limitation somehow.

P.S.: i am using the protect hacs addon

Ah. I guess that makes sense. Not really sure about HA’s notification features on Android. Related to all this, I think I saw a Protect release note somewhere that indicated Ubiquiti is monkeying with notifications in their upcoming 1.20ish release. I’m not brave enough to try a beta version, but perhaps they’ve taken a shot at implementing configurable alerts.

got a confirmation on another thread that android can’t handle streams.

do you mean the native unifi protect app?

It’s both the Protect app and the Protect system. What I’m referring to is a vague part of the release notes for the latest Protect app. We’ll probably end up with no meaningful modifications, but ohmygod do they need to make notifications better. Especially for the G4 doorbell. Otherwise, it’s a good product. Here’s the note:

https://community.ui.com/releases/UniFi-Protect-iOS-1-5-6/5693180a-00e9-441f-a7cd-1a3273febb0b

I see. Unfortunately the protect app is unusable for me. as long as they don’t add direct connect via ip address to the unifi controller. I don’t want to use their cloud service nor do I have all my devices on the same subnet.

Therefore I use my protect cams via HA directly, which does work very well.

Hi,
Do you happen to know if it’s possible to get an actionable notification URI that opens the Protect app and plays back the recording at the time of the notification?
Regards

As far as I know, this is still not possible and there’s no known way to specially call up cameras via an interface. So getting to a specific on spot in a camera’s feed would be even less do-able. But I haven’t looked into this in some time, so perhaps things have changed.

Depending on how badly you want this capability, it may be possible outside of the Protect system, by using an alternative DVR. Haven’t researched that. The Protect app and ecosystem is decent these days. Best of luck!

Thank you for the comment. The thing is that it makes sense to use my Unifi equipment as a NVR, at least for video recording, given it’s just sitting there and as you say the Protect ecosystem is pretty decent.

I’m trying to find a way to launch the Reolink app on my iPhone from an actionable notification. I’ve managed to extract below info from the IPA file but I’m unsure what the notification should look like. Would appreciate some hints. :blush:

fb1675493782511558

com.googleusercontent.apps.743639030586-0gkn62bv1l1s1govm8fqm90fnvpr4m49

1 Like

As far as I know, you’ll need an addressable link to the actual app on your phone, and I’m not sure the one you have there is correct. Not sure though. If Reolink has a community forum, you may find it there. Otherwise, you’ll need to talk with one of their developers … which I think would be pretty hard to do.

1 Like

Thanks for sharing the new Reolink identifier. This url works for me “fb1675493782511558://”

It might change though. I had “reolink://” working in an actionable notification for about a year untill it changed.

1 Like

Quick update: you can now open any app on iOS with the shortcut uri.

Just create a shortcut that launch your app, and use this uri to run that shortcut:

shortcuts://run-shortcut?name=[shortcut_name]

You can also pass inputs to the shortcut to create a switch/case and open app based on the input with only one shortcut.

3 Likes

Hello, Is it possibile instead to avoid to open any app when clicking on the notification? I just want the actions to be clicked.
Thanks

It sounds like you just need to enable a regular device notification, which is a heck of a lot less involved than an actionable one.