Persistent Notification With Camera Snapshot Keeps Using Cached Image

I’m truly at a loss for how to fix this.

I have an automation that, when a person is recognized at the front door, it creates a snapshot, saves it in a local folder (/local/snapshots/front_door_camera-snapshot.jjpg) and then sends a mobile phone notification as well as create a persistent notification.

The thumbnail that’s attached to my iPhone notification is so small it is essentially absolutely useless so when away from home, I simply use the notification as actionable to show me the live stream of my front door.

All of that works as intended.

The problem is with the persistent notification that “hangs-on” to whatever the last snapshot was and keep using that despite the file in the folder actually changing (being replaced after each snapshot). The only way that this automation works and inserts the correct image in the persistent notification is if I clear my browser cache. So that makes that absolutely worthless.

II suspect there’s something I screwed up somewhere but my google-fu is failing me severely. I’m hoping someone can point to where I’ve gone wrong. Here is my full automation…

alias: Mobile Notification When Person Detected At Front Door Between 8AM and 10PM
description: ""
triggers:
  - type: turned_on
    device_id: b951543b2ece3e9fa4116b22ac8a7f52
    entity_id: de562265a2614685749cc9785e128e78
    domain: binary_sensor
    trigger: device
conditions:
  - condition: time
    after: "08:00:00"
    before: "22:00:00"
actions:
  - action: camera.snapshot
    metadata: {}
    data:
      filename: /config/www/snapshots/front_door_snapshot-doorbell.jpg
    target:
      entity_id: camera.front_door_high_resolution_channel
  - action: notify.mobile_app_myiphone
    metadata: {}
    data:
      message: There's someone at the front door
      title: Person Detected!
      data:
        image: https://[external_domain_redacted]/local/snapshots/front_door_snapshot-doorbell.jpg
        entity_id: camera.front_door_high_resolution_channel
        actions:
          - action: URI
            title: Open Home Assistant
            URI: [external_domain_redacted]/dashboard-mobile/0
  - action: notify.persistent_notification
    metadata: {}
    data:
      title: Person detected!
      message: >-
        Someone is at the front door on {{ now().strftime("%Y-%m-%d at
        %H:%M:%S") }}
        ![image-name](/local/snapshots/front_door_snapshot-doorbell.jpg)
mode: single

Everything works except the persistent notification :frowning:

Help?!? I can’t figure out why only old snapshots are attached.

Ok, I kept searching and landed on this particular solution that is mindblowingly simple but at the same time a mindblowingly dumb for having to do it this way but hey…it works lol.

Here is the fix. Change the persistent notification URL to include a timestamp in a way that isn’t part of the filename but will force HA to not rely on any cahed image.

![image-name](http://[local_ip_redacted]/local/snapshots/front_door_snapshot-doorbell.jpg?{{as_timestamp(now())}})

And voila! It works.

Unbelievable that this has to be the solution.