My setup is a lovelace picture glance card with an image to my /local/ dir.
When my front door opens, an automation is making a picture of the frontdoor and places that in the /local/ folder, like: camera.frontdoor.jpg
I know I can set up a fake querystring here using the ?.. but this is fixed also.
I want somthing like: ?{{timeticker}}
So everytime you load the page, the file gets newly loaded.
Can this be done?
Can anybody elaborate a bit more on this? I too am having an issue with the front end not loading a more recent image.
For my setup, I have a driveway sensor that detects when cars enter my driveway which triggers a snapshot automation, saving the snapshot, sending a notification and shows the image in a picture elements card in Lovelace. Being able to force a refresh of that file is ideal but I’m unsure on how to do it.
So I have found a work around and it actually works pretty slick so I thought I would share it. My automation takes a snapshot and saves it to the www (/local/) directory like so…
This camera file_path should match the location of where the automation saved the picture to. What this camera setup does is continually check this file and will update it live as if it was a camera feed. So in the next step when we add it to a picture card in lovelace, as the automation creates the new picture, the camera local_file will automatically update the card with the new pic! So here’s the card setup…
Then in your dashboard YAML use the value of that name: variable for your camera_image: entry. So in the above example the name is camSnap1frontdoor and that makes the corresponding entity camera.camsnap1frontdoor. So my dashboard card YAML ended up as:
elements: []
type: picture-elements
camera_image: camera.camsnap1frontdoor
title: Most recent still image capture
All that is probably obvious to everyone on this thread, but I’m new to this so it took me some head scratching and searching – maybe that’ll help another beginner some day.
Hello.
Just to say many thanks for the tip. I have an outdoor Blink cam and I made a dashboard card where the picture is uploaded. But I found an issue. The picture showed is not the last one, but the last but one.
I checked the file in save folder, and it is not the last taken picture whereas on the blink app, the last picture is OK
yeah I know this is old. But I got directed here by a google search and wanted to share a slightly different solution - different use case mind you - but it might work otherwise.
In my case I use card_mod to set a background image from a url with a unix timestamp that refreshes on its own. image automatically updates itself in the background. the beauty of this is you don’t need a camera entity, and you can apply this to virtually any other card.
Wanted to say thanks for this, and add a few comments. I also used a versioning trick posted elsewhere to automatically update pictures. My doorbell saves a picture when someone rings the bell. Nice to quickly see who it was.
First observation for both this and the versioning trick is that I have different results depending on if I open the lovelace dashboard on my laptop or iPhone (HA app). Both connected to local WiFi (same network as doorbell and HA).
Using the versioning trick (adding ?v=1 to local picture URL): phone and laptop show a different image. Laptop using Firefox and refreshed using ctrl-f5. Phone still shows an old picture.
Then proceeded with tips from here making new picture glance and entity cards. I also decided to add a second camera using Benish suggestion and link to a 30 second mp4 video the doorbell also saved. On my laptop that shows a grey screen with a broken icon in the middle. Saved anyway to try and fiddle some more today but to my surprise on iPhone it works - just not on laptop (where I usually configure stuff).
HA dashboard on laptop (this plays a video fine on my phone)
if the button has nu further content it won’t make it big of course. So your choice of a fixed height might have done the job
I do think the picture-elements with the ‘fake camera’ is a nice find, it works well for me, and will also refresh without having to refresh the browser (which is an issue with the CSS based solution)
having some trouble with this.
should the file_path be /config/www/folder/pic.jpg or should it be /local/www/folder/pic.jpg
I’ve tried both and not getting it to work. The camera entity does show up in devices and services along with other camera entities but it doesn’t have a picture thumbnail like other ones.
my best guess is that the issue is with my file_path. I’ve also seen sometimes the “www” is skipped in the local file path if i’m access via local url. Could you please check again to see how yours is on the current HA version
I am trying to create a short animation for my dashboard barometer, when I double tap the barometer I want the needle to flick briefly in the direction corresponding to a rising or fallin atmospheric pressure.
I followed the advice on this thread and have had a partial success, in that the three images I use to create the animation work sometimes!? My main png file is in the /config/www/ directory and I overwrite the it from an external device (my Android tablet running a Python program) dynamically. I have tried to vary the speed of the animation and the number of times is runs but after a brief time the images stop being updated. I have used several methods to trigger the local_file_update_file_path (MQTT, Folder watch) but this Action seems to stop working after a while?
On my PC I have to clear the browser cache to get the animation to restart and on the companian app I just reload the app.
If anyone can point out the errors of my ways I would be most grateful.
Does Local_file have a limit to the number of updates it can handle in a certain time frame, I am trying to get 3 images displayed in about 1.5 seconds, maybe this is too fast for Home Assistant?
I’m running HAOS and HA on a Raspberry Pi 5 8GB with 500GB NVME, lastest version of all components *
Core 2025.1.2
Supervisor 2024.12.3
Operating System 14.1
Frontend 20250109.0
Many thanks in advance for your help - I am not a Home Assistant expert, Colin.