I am capturing images and videos from my IP cameras, and wasn’t finding a Gallery to view them that fit my desires, so I wrote my own custom panel. Sharing in case anyone else finds this useful…
Be gentle, it’s a first of many for me (Hass coding, even github).
#1 is certainly doable. I’ll circle back and do that as soon as I can.
#2 I’m not sure if I can do. It can certainly poll any directory hass can get at, but the issue is rendering those results in the webpage if those files are not accessible from the web. I’ve done that in other languages, but it needs some middleware to fetch the file contents that I have no idea if it exists in hass.
This is awesome I had been looking for something like this, but I am having trouble getting it to accept my folder:
Invalid config for [sensor.files]: not a directory for dictionary value @ data['folder']. Got '/config/www/cam_captures/front'. (See ?, line ?). Please check the docs at https://home-assistant.io/components/sensor.files/
- platform: files
folder: /config/www/cam_captures/front
name: gallery_images_front
sort: date
Is it because it is a couple levels in? If I put the full path it contains that in the URL when trying to view the image. the cam_captures dir is in my whitelist and works iOS notifications which require URL
Hrm, strange. No, it shouldn’t be the depth…mine works fine with the below, which is similar.
And you say you can view images from a browser using the equivalent path?
I would guess that the user your hass instance runs under doesn’t have access to that folder, maybe? Does it create those images (via snapshot, etc)?
- platform: files
folder: /config/www/downloads/front_door
name: kuna_vids
sort: name
Yes they are snapshot images which then get sent via iOS notification. I can access them directly with the url… it seems it is looking to replace /config/www but I have to use the full path which it then does not replace… when I look at the state of the sensor it shows the entire path there as well.
Sorry, I’m at work on mobile so it would be hard to copy the code but it looked like in gallery.html “imageLocation” did a replace of the path and looked for /config/www (I am no programmer… just dabble enough to try to see how stuff works )…
so it seems that since I can’t use the /config/www path (only full Linux path works without error in config) it isn’t doing the replace.
For the heck of it I chmod’d the dir to 777 and still had the issue.
Edit: I don’t know if something is wrong with my setup as I can’t even add /config/www to my whitelist as it says it doesn’t exist (although I wouldn’t think that would matter as the cam_captures directory is already whitelisted with the full path, I tried adding one with /config/www and it says it doesn’t exist.
Yes I do but each image listed with the full Linux path as that was the only one that let the config check pass (I can screenshot shortly or copy from states page soon )…
so here is part of the attributes of the sensor…
So… that is what it appends to the URL in the gallery page https://MYURL/home/homeassistant/.homeassistant/www/cam_captures/front/front_yard_1571270525.jpg
do you think something is not right in my HA that I cannot use /config/www at all? I see other posts where people refer to folder_watcher/sensor type issues but they all seem to be using directories that are actually outside of their HA config folder.
I looked at any other situations where I use paths and it seems I always use the whole path starting with /home… command line sensors, snapshots etc all work fine.