Frigate notification snapshots

Howdy folks,

New to Home Assistant and love it so far. Trying to learn as much as I can. For some reason my notifications in Home Assistant/Frigate to iOS only seem to partially work when away from the home server.

Partially, in that I’ll get the alert and there will be a mini-snapshot in the notification but if I tap the notification to make it bigger, it fails. I get an error that says “Snapshot not available”.

My setup is as follows:

UnRAID hosted Home Assistant in VM
Frigate hosted in Docker in UnRAID
Frigate passes camera feeds via MQTT to Home Assistant
HACS > Frigate
Frigate Notification Blueprint with defaults

You can see the URL here that Home Assistant is trying to send @ https://ha.domain.TLD:8123/api/frigate/notifications/1704564716.426493-4dveic/snapshot.jpg

I’m using Cloudfare for DNS pointed to my WAN address. An A record for the subdomain
Let’s Encrypt is running the SSL certificate so I can do DNS-01
Nothing is forwarded outside of the firewall

Can you think of a reason why notifications and a tiny snapshot work but a larger view doesn’t work?

I sort of went through my first Frigate setup and had to address this, at least for Android. I took the approach of using the Frigate integration to save a snapshot to a directory under media storage and then you can just reference the path under media to get the image notifications. Might not be the only solution, but it was the one that seemed to work for me. Hope this helps!

alias: Notify tablets that someone is at the door
  - variables:
      snapshot_filename: DoorCam_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg
  - service: camera.snapshot
    target:
      entity_id: camera.front_door_2
    data:
      filename: /media/snapshots/{{ snapshot_filename }}
  - service: notify.all_phones
    data:
      title: Front Door Camera
      message: Person at the front door
      data:
        image: /media/local/snapshots/{{ snapshot_filename }}
        url: front-door-person/0
        clickAction: front-door-person/0
        actions:
          - action: URI
            title: View Live Feed
              uri: front-door-camera/0

Thanks for that. What configuration file is it and where might I find it?

My automations.yaml and configuration.yaml doesn’t have anything that looks like that. I am using the SgtBatten blueprint for Frigate Notificaitons. Is there a better one you recommend?

That is just a snippet from the middle of my automation for what I use to detect. I’ll drop the entire automation below:

alias: Camera Control - Front door person detect
description: ""
trigger:
  - platform: state
    entity_id:
      - binary_sensor.front_door_person_occupancy
    from: null
    to: "on"
  - platform: event
    event_type: amcrest
    id: start
    event_data:
      event: CallNoAnswered
      payload:
        action: Start
    enabled: true
condition:
  - condition: not
    conditions:
      - condition: state
        entity_id: input_text.house_mode
        state: sleep
action:
  - service: input_boolean.turn_on
    target:
      entity_id: input_boolean.display_doorcam
    data: {}
    enabled: true
  - repeat:
      count: 2
      sequence:
        - service: tts.speak
          metadata: {}
          data:
            cache: true
            media_player_entity_id: media_player.all_tablets
            message: Someone is at the door
          target:
            entity_id: tts.piper
        - delay:
            hours: 0
            minutes: 0
            seconds: 3
            milliseconds: 0
    alias: Notify tablets that someone is at the door
  - variables:
      snapshot_filename: DoorCam_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg
  - service: camera.snapshot
    target:
      entity_id: camera.front_door_2
    data:
      filename: /media/snapshots/{{ snapshot_filename }}
  - service: notify.all_phones
    data:
      title: Front Door Camera
      message: Person at the front door
      data:
        image: /media/local/snapshots/{{ snapshot_filename }}
        url: front-door-person/0
        clickAction: front-door-person/0
        actions:
          - action: URI
            title: View Live Feed
            uri: front-door-camera/0
    enabled: true
  - delay:
      hours: 0
      minutes: 2
      seconds: 0
      milliseconds: 0
mode: single

So this is the automations.yaml file? And you’ve got snippets for each ‘type’ of automation, in the case when Frigate sends a detection notice?

In the UI, if you made a new automation, then switched to yaml mode and pasted this in and saved, you would see how it would appear in the automations.yaml.

Are you using any kind of port forwarding or reverse proxy to see snapshots or video clips when not connected to your home network? I haven’t been able to get your code working unfortunately. My fault, not yours :slight_smile: The blueprint I have is working with the exception of being able to actually open the snapshot when away from home network. Oddly enough, it sends a thumbnail in the alert no way to see the snapshot.

Works great with nabucasa on my end. The snapshots will work if you are saving them to ‘media’ and have media storage added to HA

Trying to avoid purchasing another subscription :slight_smile: But if it works I may consider it. I’m not sure where ‘media’ and/or ‘media store added to HA’ are working from?

Here is my YAML. I’m using Cloudflare DNS and Let’s Encrypt with HA presently.

alias: Frigate Notifications (0.12.0.2)
description: “”
use_blueprint:
path: SgtBatten/Stable.yaml
input:
camera: camera.doorbell
title: Motion Detected @ Front Door
update_thumbnail: true
ios_live_view: false
debug: true
zone_filter: false
tap_action: “{{base_url}}/api/frigate/notifications/{{id}}/snapshot.jpg”
attachment: snapshot
base_url: https://sub.domain.TLD:8123
notify_group: all_ios

If you have your HA instance exposed to the internet on 8123 where you can get to it without something like nabu casa or some VPN type thing, its not a good idea.

If you DO have something like nabu casa or a VPN sort of thing, then you likely dont have access to the snapshot using that base URL from the app.
Media storage is part of HA, and if you are in the HA app and its working from however you are connecting to, you dont have to use the base URL anymore as you can just directly go to the path as the HA app knows how to find it.

Not using NabuCasa or VPN. HA isn’t exposed to Internet. It’s just using DNS-01 so I can use a domain name instead of 192.168.1.20.

It’s so weird the way it works. For snapshots, when I am away from home, I get a notification with at thumb nail but the snapshot isn’t available. However, if I have video clip turned on (still remote), I can watch a live view of the clip. How is that even possible? :slight_smile:

When I’m at home, both work fine.

The reason is because the notification ‘sends’ the picture as an attachment, and is stored on the device until it’s cleared… or at least thats what I have inferred from my observations and the documentation.

When you open the app, you must have access to the value of BASE_URL. If you could access your home assistant using the value in base_url when you are remote, then the clip/snapshot should show up. I will bet it does not work that way.

Makes sense! So this is where either using a reverse proxy to allow access, or being connected via NabuCasa, VPN/wireguard/tailscale at that instance would work but not having any of those things means I cannot access the ‘local’ path.