Show animated gif without caching

Does anyone know how to load an image without caching it in the lovelace front end?

I have a single loop animation (gif) I want to display full screen everytime motion is detected (for halloween). I have it all working as a conditional picture elements card, however each time the image pops up full screen it is ‘stuck’ at the end of the gifs single loop (rather than replaying the full loop from the start).

I’ve tried setting it up as a picture elements card, but no joy as the image is cached and so doesn’t re-start the animation (as it’s not actually reloading the image).

I’ve also tried setting it up as a camera with a static file_path: as the image feed. “Camera_view: live” does the same single play behavior. “Camera_view: Auto” does reload the image but restarts it every 5ish seconds rather than playing the whole loop on each trigger.

I suspect the solution lies in adding a variable to the file being called somehow but it’s beyond my knowledge on how to do something like “test.gif?ver=”. Altermnatively is there a way to set the refresh rate on a camera?

My current configs are below in case it helps (camera approach). The gif is a single loop.


Config

camera:
  - platform: local_file
    name: halloween_scare
    file_path: /config/www/images/halloween/test.gif
    scan_interval: 10

Lovelace card

type: conditional
conditions:
  - entity: timer.pir_lounge
    state: active
card:
  type: picture-entity
  entity: camera.halloween_scare
  camera_image: camera.halloween_scare
  show_name: false
  show_state: false

To close this thread, I never did find a solution within HA. I ended up coding an ajax webpage to display videos, and doing a webcall from an automation in HA to trigger a change of the video playing. It works great but probably of little use to anyone else unfortinuately.

1 Like