Gallery Panel for images/videos

It doesn’t refresh if I click another Home Assistant page and then come back. I’ve tried going into Supervisor or Configuration pages too, but no refresh unless I refresh the browser or kill the android app.

If you go into the Media Browser, do you see the new files there?

Yes.
10 character minimum post :slight_smile:

Very strange. It should reload from the media source when you visit the page. Not sure why yours isn’t.

Anyway, when I make another set of changes, I’ll add a button with some config around it.

I’ve got the gallery card working with the media folder but it is very slow for the video to render, even with a max limit of 10 files for the media-source entity. I had hoped that a core I5 NUC with a fast SSD would be much snappier with Gallery and a usable alternative to an NVR.

So the solution will be to install the files component, but I can’t seem to find it via HACS integrations search. I know I can easily install it manually, but prefer HACS to keep up with updates.

EDIT: Nevermind - I simply added your repo URL https://github.com/TarheelGrad1998/files to HACS and installed it that way. I had expected it to show up in a HACS search directly.

Yes, sorry about that, I hoped so too. However, it seems HACS now has a requirement that integrations have logos added into the Core application before the integration can be included as a default library.

I disagree with this, because a) what’s the point of having these as “add ons” if it requires inclusion of something in the Core, and b) in this case, it’s not a Ring or Roomba or similar component, but just an unaffiliated library to collect data for the card. So I’m just not going to create fake logos to check into Core to meet this (in my case) arbitrary requirement. And I couldn’t get anyone on the HACS side to respond.

So, it probably will never be in HACS by default. For what it’s worth…

understood, and thanks very much for this integration and card. Maybe consider a slight update to the files installation documentation. For HACS, under the 3 vertical dots menu, select Custom Repository, and add your github files url.

and for what it’s worth, when searching for custom integrations in HACS, I saw too-many-to-count instances of the icon “Icon Not Available”. Now that’s a good icon for your Files, eh? :slight_smile:

I believe those are the ones who were submitted before the icon requirement was implemented. But…yeah, I’d take it, if I could get it. :slight_smile:

It’s here:
https://brands.home-assistant.io/_/_placeholder/icon.png

or better yet, just provide a existing generic icon that represents files, such as mdi: file-multiple

Hrm, I had hoped you were onto something, but I don’t see how I can configure that, or am I missing it?

I.e. this is all I see in the documentation…I assumed that meant it picked up icon by the integration name?

Home Assistant Brands#

You must have added your integration to home-assistant/brands conform to the UI standards in Home Assistant.

Hey David - my comment to use that “icon not available” icon was in jest.

I just now had a look at the custom integration icon requirements doc, and whipped up a couple of simple file icons that meet the specs for you to consider. They are both square and have transparent backgrounds.

icon.png : 256x256 and [email protected]: 512x512.

icon

Also, I guess you are already aware that the manifest for files needs a version added.

I have the following directory structure
image
In each folder with date there is a subfolder with Camera Name.
Recursive: true, but somehow Gallery Panel displays only the 1st folder’s contents. Is it possible to force displaying last folder’s (date) latest (date-wise) files?

You are using the Media Source method, I assume?

Are your file names within the folders named so that they contain the date (and will sort appropriately if listed independent of the folders)?

The first thing that comes to mind is trying the following option:
reverse_sort: true

…but the success of that depends on the above questions. :slight_smile:

If it’s already true set it to false and see if that helps.

Yes, I’m using Media Source.
Nope, files contain only time, the date is selected by NVR system.
File names:
image
Date is reflected in Folder names (as above).

Ah, yes that’s the problem. Unfortunately the Media Source doesn’t return the actual dates, so it’s sorting by the file names (just the times in your case) and returning the first X, which could be all one day, depending.

Hrm, I’d have to think about how to adjust to fit your case. I could sort by folder path as well as file name, but that might not do it for you either since one camera being more active than the others could hog all the returns. Or, as you suggested, add in some way to dynamically build the path to include current date.

Yes, that would be useful. Thanks!

Hey all,

Ive placed gallery-card.js in /config/www
Ive added the js as source in lovelace, can add custom: gallery card
Ive placed the 3 .py in /config/custom_components/files

added this to configuration.yaml:

sensor:
    - platform: files
      folder: /home/homeassistant/.homeassistant/www/images
      filter: '**/*.jpg'
      name: gallery_images
      sort: date

I added 3 custom *.jpg to the config/www/images folder

when I add custom: gallery card with this:

type: 'custom:gallery-card'
entities:
  - sensor.gallery_images
menu_alignment: Responsive
maximum_files: 10
file_name_format: '%YYY_%m_%d_%H_%M_%S'
caption_format: '%m/%d %H:%M %p'  

i get the following error:

No images or videos to display

If you look at sensor.gallery_images under developer tools, does it list your files? Or any files?

If no, do you have any relevant errors for the files component in your log?

I get:

path: /home/homeassistant/.homeassistant/www/images/
filter: '**/*.jpg'
number_of_files: 0
bytes: 0
fileList: []
sort: date
unit_of_measurement: MB
friendly_name: gallery_images
icon: 'mdi:folder'

Could it be that the “images” folder is a symlink to another one? (I linked it to a folder where my camera’s store their snapshots)
When I go to …/www/images on the samba server it loads the images up nicely.

To check if its the symlink, I removed the symlink and made a folder with some images inside, same result.
I also have no errors regarding this component in my log.

2021-04-12 09:32:56 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-04-12 09:32:59 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for files which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-04-12 09:32:59 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for samsungtv_tizen which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-04-12 09:38:13 ERROR (MainThread) [frontend.js.latest.202101277] https://xxx.ui.nabu.casa/lovelace-hoofd/default_view:0:0 Uncaught
2021-04-12 09:45:55 WARNING (MainThread) [homeassistant.components.automation.nieuwe_automatisering_2] Oprit Line Crossing: Already running
2021-04-12 10:16:02 WARNING (MainThread) [homeassistant.components.automation.nieuwe_automatisering_2] Oprit Line Crossing: Already running
2021-04-12 10:16:03 WARNING (MainThread) [homeassistant.components.automation.nieuwe_automatisering_2] Oprit Line Crossing: Already running