Android notification with image

I have a unifi g4 bullet aiming towards our driveway with vehicle detect turned on. My end goal is when a vehicle drives down the driveway, I get a notification with a snapshot of the camera. My hangup is that I can’t get my snapshot image to show on my notification, but I do get the text.

alias: Testing snapshots
description: ""
  - type: moving
    platform: device
    device_id: device_id_here
    entity_id: binary_sensor.g4_bullet_vehicle_detected
    domain: binary_sensor
condition: []
  - service: media_player.play_media
      entity_id: media_player.vlc_telnet
      media_content_id: media-source://media_source/local/ERA-2-Ding-Dong-2.mp3
      media_content_type: audio/mpeg
      title: ERA-2-Ding-Dong-2.mp3
      thumbnail: null
      media_class: music
      children_media_class: null
        - {}
        - media_content_type: app
          media_content_id: media-source://media_source
  - service: camera.snapshot
    entity_id: camera.g4_bullet_high
      filename: '/config/www/lastVehicle.png'
  - device_id: device_id_here
    domain: mobile_app
    type: notify
    message: test
      image: '/local/lastVehicle.png'
mode: single

That is my current setup, it sends text, but no image. There is an image at /config/www/lastVehicle.png
Any input would be appreciated. Thanks.

is your image accessible remotely? HA needs to be accessible remotely so the app can download the image when received

How do I tell if it is remotely accessible? The way I understand it is that if you put it in the /config/www folder it is remotely accessible, although I don’t know how that works.

navigate to and see if it loads

your HA URL needs to be accessible to the outside world, the www folder only makes it so the folder contents can be accessed without authentication. The reachability of the URL is not the same thing there :slight_smile:

Ok I see. What kind of domain would I need and how do you upload the image to said domain? Would I basically have to serve my own website?

it can be any domain, and you keep the file in the same location. Might be easiest to consider using Nabu Casa cloud.

Ok thanks for the input. We do have a static ip here, so that and some port forwarding could be an option I suppose.

I use the following code to send a camera image notification without needing to use snapshot

  - service: notify.notify_bob
      message: Drive image
        notification_icon: mdi:cctv
        image: >-
          state_attr('camera.drive_person','access_token') }}
        tag: drive-motion

camera.drive_person is my cameras name, replace it with camera.g4_bullet_high and you should be set.
As others have said, images in notifications require that your HA is accessible.

the only issue with this approach is that the image will be taken when the notification is received on the device so if the notifications is delayed the image will be taken from a later time. By saving a snapshot before sending the image you guarantee the image is what you expect. As I can see above you are not using the critical format so notifications can be delayed until the screen turns on.

1 Like