I want to be able to have a card that will page through multiple images. The images will be snapshots from camera, so they will be dynamic. I want to do it through HA, not through a separate web server service. Not sure how to achieve this.
make a generic camera integration point to a static image. Then use a python script that looks at a library of images and copies the ‘selected one’ to the static image path. Then use a picture glance card that points to the camera. And the ‘glance icon’ point to the script using a service-call.
Thanks. I thought about that, but was hoping there was a simpler solution I missed. I’ll do what you suggest.
@petro 's solution works. However, there is a delay in displaying the image, since the glance card seems to update the image at its own rate, rather than being triggered by any actions that copies the pictures. The glance card refresh for this seems to be about ten seconds, or so, rendering it useless to interactively page through the different snapshots that I have.
Changing the frame rate on the generic camera does not help. Changing the camera to a local_file does not make a difference either, including using the service camera.local_file_update_file_path.
Not sure whether there is any method to force update the UI.
Change the glance card to have the following attribute (docs)
camera_view: live
It will update immediately.
Actually putting camera_view: live
totally disables the update. (or at least much longer than without camera_view: live)
Here is my camera defintiion:
camera 5:
- platform: generic
still_image_url: http://127.0.0.1:8123/local/snaps/kitchen/current.jpeg
framerate: 5
name: kitchen_snap
and the top of my picture -glance card is like this, without the camera_view, which I said makes the problem worse.
cards:
- type: picture-glance
camera_image: camera.kitchen_snap
entities:
- entity: script.page_pictures
icon: 'mdi:arrow-collapse-left'
tap_action:
action: call-service
service: script.page_pictures
service_data:
room: kitchen
action: first
- entity: script.prev_pic
icon: 'mdi:arrow-left'
tap_action:
action: call-service
service: script.page_pictures
service_data:
room: kitchen
action: prev
I am using HA 100.3
without camera view it will update every 20 or so seconds. With camera view, it should update when the feed updates. I.E whatever your framerate is.
@petro I’ve got it working. It turns out to be a webserver issue. I was using HA server’s own URL to get the camera image. I think that there is some cache-control there which I don’t know how to manipulate.
I set up a Nginx server and make the generic camera point to that, and it seems to be working.