luixal / lovelace-media-source-image-card

A Lovelace custom card for showing images stored in Media Source
GNU General Public License v3.0
21 stars 0 forks source link

Feature suggestion - folder browser #8

Closed mihaimdinca closed 8 months ago

mihaimdinca commented 8 months ago

At the moment I use this card as a way to browse through the pictures in a folder. An automation saves pictures to that folder on a trigger. This has many applications like doorbells, security cameras and others. The way I use it is by defining a folder sensor in my configuration.yaml linked to that folder. I use the attributes of that sensor - the file_list specifically and an input_number helper in a the template that indicates the image location on this card. With two buttons I increment or decrement the input_number helper so I can change the index for the file_list and thus show a different picture. I do not have the coding skills required for java or python (more of a vb.net hobbyist) but I think it would be nice to be able to define a folder and browse through the files just by filling in the details in the card config.

My working card config looks like this type: custom:media-source-image-card image: >- media-source://media_source/local/Doorbell/motion/{{((state_attr("sensor.motion","file_list")|sort(reverse=true))[int(states('input_number.doorbell_picture_number'))])[23:]}} entity_id: input_number.doorbell_picture_number

luixal commented 8 months ago

Hi,

I think you're following the right path. The feature you describe is quite big and has many ways of doing it: arrows at left/right so it works like a carousel, an scrollable list of files on a sidebar, thumbnails at the bottom...

I think is better to keep the card as simple as it can be and build more complex solutions like this the way you're doing, using another cards.

i.e: this is how one of my cameras cards looks like:

image

I made it using a custom:stack-in-card card to put together a custom:webrtc-camera card that renders the camera view and then an horizontal-stack card to make the controls at the bottom using some custom:mushroom-template-card cards.

I think you should make something like this to match your taste.

mihaimdinca commented 8 months ago

I agree. Thank you for sharing your ideas and project.