🔔 Notifications - Actionable Mobile Notifications Script, with optional Timeout Feature and Camera Snapshots [works with iOS/Android]

Well, I am close but I cannot get any camera image in the notification.
This is the YAML I have:

alias: 🔔Send Motion Notification
use_blueprint:
  path: samuelthng/notifications.yaml
  input:
    notify_device: 9f8ff81591a0936eb19abc1b944fd120
    title: Vehicle Detected at Intercom
    message: A vehicle was detected at the Rio Crest gate intercom
    icon: mdi:motion-sensor
    confirm_uri: com.mcu.reolink
    confirm_text: Launch Reolink
    confirm_option_mode: action
    dismiss_enabled: false
    notification_link: app://com.mcu.reolink
    attachment_type: camera_entity
    attachment_camera_entity: camera.rc_intercom_fluent
icon: mdi:motion-sensor

The resulting notification is (no snapshot on the message):

Launching the Reolink app works perfect.

If I “build the URL” I would suspect it should be (NOTE: I use Nabu Casa as this is a remote Home Assistant), I get the image no problem:

https://xxxxxxxxxxxxxxxxxxxxxxxxxx.ui.nabu.casa/api/camera_proxy/camera.rc_intercom_fluent?token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

A few words about what I am trying to do … I have a gate that is about 1 mile away from my winery. I want a notifications to folks when someone hits the gate. Home assistant exists in both places (winery and gate) but they are completely different systems even on different ISPs because of services that are available at the locations. Winery is on Starlink, gate is AT&T 5G so different routers, etc. And Home Assistant installed in both locations.

If the notification has something like “show image from local home assistant” that will not work, because the “viewer” might have Companion pointed to the winery. I would note that in examining the trace, I see this (token x’d out):

notification_data:
  apple_device: false
  subject: ''
  visibility: private
  importance: default
  priority: high
  ttl: 0
  clickAction: app://com.mcu.reolink
  image: >-
    /api/camera_proxy/camera.rc_intercom_fluent?token=xxxxxxxxxxxxxxxxxxxxxxxxxxx
  notification_icon: mdi:motion-sensor
  channel: General

So does this mean that the notification arrives on the phone and the Companion app goes to “/api/camera_proxy/…” to get the image. If this is true, then I can understand why I get no image because my companion app is pointed to the Winery and not the Gate (completely different Nabu Casa URLs and the cameras are at the gate, not at the winery).

Note I am using the latest blueprint “Notifications (Version 2.0.2 Beta)”

OR … is their some limit on the image size? I would note this is a dual lens Reolink camera so the image is 1536 x 576

Update: I have diagnosed and this is a correct statement:

… the notification arrives on the phone and the Companion app goes to “/api/camera_proxy/…” to get the image.

I had been testing with my phone pointed at the Winery, I changed the Companion App server to point at the Gate and lookie, lookie (I get an image like I want in the notification):

Unfortunately that is not acceptable as a solution because it means people need the companion app pointed to the Gate when at the Winery. And therefore could not control lights/music/etc. So I believe an option needs to be made for the image to be a full URL to a remote server.

I would think this should be modified, accepting like an input_boolean for internal (default) or external… If external, the link for the image should be built with some user-provided external server (assuming this works but I would think it would unless the companion app notification cannot deal with absolute URLs):

  - alias: Attachments
    variables:
      script_attachment_type: !input attachment_type
      attachment_type: "{{ iif(field_attachment_type is defined, field_attachment_type, script_attachment_type) }}"
      script_attachment_camera_entity: !input attachment_camera_entity
      attachment_camera_entity: "{{ iif(field_attachment_camera_entity is defined, field_attachment_camera_entity, script_attachment_camera_entity) }}"
      camera_image_url: >-
        {% if (attachment_camera_entity|length) %}
          {% if (state_attr(attachment_camera_entity,'entity_picture')|length) %}
            {{state_attr(attachment_camera_entity,'entity_picture')}}
          {% else %}
            {{"/api/camera_proxy/{id}".format(id=attachment_camera_entity)}}
          {%- endif %}
        {%- endif %}
      media_url: >-
        {{
          {
            'none': '',
            'camera_entity': iif(camera_image_url | length, camera_image_url)
          }.get(attachment_type)
        }}

As in:

variables:
  ...
  script_camera_remote: !input attachment_remote
  script_attachment_remote_server: !input attachment_remote_server
 ...

And then build the URL depending on whether you need an external HA camera source or an internal HA camera source. Given this from the notification service, I would think remote connections work as the first example is an absolute URL:

automation:
  - alias: Notify Mobile app attachment
    trigger:
      ...
    action:
      - service: notify.mobile_app_<your_device_id_here>
        data:
          message: "Something happened at home!"
          data:
            # an example of an absolute url
            image: "https://github.com/home-assistant/assets/blob/master/logo/logo.png?raw=true"
            # example of a relative url
            image: "/media/local/image.png"
            # the same works for video
            video: "/media/local/video.mp4"
            # and for audio
            audio: "/media/local/audio.mp3"

This makes it even more evident that that URL sent to the notification service is a relative URL and not an absolute URL.

One note: I tried with no success to do things opposite. Since I use the Remote Home Assistant integration to link the two together, I can trigger the script/automation locally on the Winery Home Assistant. Good start but no bueno, I cannot get the image from the remote camera … images do not work from cameras in Remote Home Assistant AFAIK.