Adding local pictures to dashboard picture card - what path to use?

I am running HA OS 8.1 updated on 2022.5.5 running on an i5 NUC.
I am new to HA and all was going well with many integrations and general configurations working.
I am currently constructing a number of dashboards in which I wish to include picture cards containing my own pictures. I have set up Samba and used my other PC to populate the automatically-created by HA ‘media’ folder with some test pictures (small jpegs). The problem is I cannot work out how, assuming it is possible, to set the image path in the dashboard ‘picture card’ code to an image in this /media folder. I can see these pictures by clicking on the media sources folder within HA under Local Media though. I can also load pictures using a web URL but can’t set the path to the local images correctly. Have I missed something?

Hi,

To serve static content from your HA instance like pictures for picture entity cards please check the doc here : HTTP - Home Assistant

Short : create a www folder in the config folder. Place here your images, use as URL : /local/your_file.ext
You can also use sub-folder(s) in www with URL : /local/sub_folder/you_file.ext

Edit : BTW, welcome to HA
Keep your setup up to date, check your recorder config before your database size increase too much. HF !

11 Likes

I use the www folder
image: /local/folder xxx/picture.png

1 Like

Thank you to all posters pointing me to using /local/myfilename as long as myfile has been added to the www folder. I will do that if that is the only solution. I just wondered what the auto-created media folder (that I can populate using Samba) is for if not for a convenient store of my local images and videos. I can see them in /media folder and view them, I just can’t seem to find the path to them when completing the Image Path (required) field of the Picture Card Configuration. Have I missed the point somehow?

P.S. I have now used the suggested path and it works fine thank you but I’m still not sure why the /media folder in HA seems unusable in this use case.

1 Like

I’m struggling with the same issue. I tried to save my camera snapshots to /media folder, but then they were unavailable for picture card. But at least it was possible to attach the image to a companion app notification. But then I noticed that the image no longer required authentication!!! Nowhere in the documentation does it say that images in /media folder will be publicly available after they have been used in a notification!!!

Try this:

Then edit dashboard, add card by entity, search up the camera entity you created above, and add the suggested picture entity card to the dashboard.

1 Like

I’m so sick of having this issue. Why can’t HA make this easy?

1 Like

i know this is a very old thread and probably dead but for those who come after me: any media found in media > my media can be used, including nas drives you have linked. simply go to my media > image > click the play button > right click image > copy image link

use the path you copied in the image path box for picture cards.

3 Likes

Thanks! That worked perfectly.

Thanks, worked flawless :slight_smile:

Spoke too soon. My authentication tokens seem to be expiring after a short period every time I try the above, and I end up with this:

Replacing with a new copied image link from the media tab (containing a new token) fixes the issue, but only temporarily. Any idea what might be causing this?

Same, the URL changes after some time… Clicking the “old” url provokes a “authentication failed” event in home assistant… Any other ideas how to use images easily?

Edit: I go with the hosting my file in the /config/www/ directory like @hassiopi mentioned.

If you put the image in /config/www, then the image will be exposed to the internet. If someone gets the link to the image, they will have access…

The method I use is in this post:

Basically using the “gallery-card” installed via HACS. Then the gallery card will have access to the image stored in a directory not exposed to the internet.

I’ve been using the Media Source Image Card. HACS.