Trying to display an image from local folder in HS

hey guys, quite new to home assistant , i would appreciate if someone can point me in the right direction … i have an IP cam setup to display a permanent stream in HA, but it also take 4 pictures and saving them to my nas, i’m looking for a way to display the latest image saved in HA … anything in HA that could support that ?

Give Local file camera a go.

Thanks I’ll give it a shot tonight

I had seen it previously but having a different image name for every pictures prevented me from using it

What I will try ,

Running an incron folder monitor to move and rename the newest picture in the watched folder and move it to another folder overwriting the image I’m watching with the local file component

That should work :slight_smile:

I was yo focus on using only HA to do it but that combination should work :slight_smile:

I’ll post the results later tonight if it is of interest !!

Thanks for the suggestion , it provided me the basic idea to come up with that one

I’m interested; even if for nothing else than more knowledge. Thanks!

Sorry i’ve been to busy last night , we’ll do it this weekend and get back to you then :slight_smile:

1 Like

No rush; you’re not on a clock here! Thanks!

Ok just a quick update :slight_smile:

I reconfigured the HASS for my camera,
Configured a NAS drive to accept all the photos taken
Mounted a drive from Raspbian to that NAS
Added a symlink to that mount that is residing in the .homeassistant folder

then configured my incron job to monitor move and rename the files to be able to fetch it with the camera local component.
It worked well for the first hour , i was able to get the new file created / moved and renamed to the destination drive but then …

Stopped working as my camera is creating a structure per hour to store the file .
Which means that my photos are stored into a structure like this : Photos/date/hour/photoname.jpg

This is more complicated than i thougth . as not being that good in bash , i will need some reading to try to monitor each daily/hourly created folders and move / rename the file to the folder i’m monitoring with the local camera component.

Any help for a general bash script that i could use to do the job which i would run as action from my file watcher.

i will anyway work on it , but it might be faster with a small hand :slight_smile:


1 Like

I have a similar problem. My Webcam stores images when motion was detected. I did a python script which makes an animated gif with timestamp of only the images where a significant change was detected (remove small changes due to illumination changes).
I store this file (res.gif) at ~/.homeassistant/www/
in the configuration I use:


  • platform: local_file
    file_path: /local/res.gif
    name: AniGiflocalGIF

but this is not working (identation is correct - I just did not get the spaces into the post)
I can’t find the reason for this in the documentation
Any ideas?

Hi all,
I got it working now using:

file_path: /home/pi/.homeassistant/www/res.gif

ist not as descirbed the relative path of the www directory of hass - its the absolute path…

I am setting up my camera pictures from FTP and would like to use your python script for moving files and creating animated gifs. Any chance in sharing?

The source for image2gif can be found at

I wanted to attach my script, but this in unfortunately not allowed.
Feel free to copy and adapt the following lines:

[details=Source Code][code]

-- coding: utf-8 --

Created on Tue Nov 15 22:35:50 2016
Test script to get images (FPT ipcam images) and generate animated gif

* needs mout of ftp / load images from ipcam
* check the newest x images
* only select interesting images - reduce by similariy to previous image
* store similarity data (not done yet)
* generate gif image (or animated png)

pip install apng


@author: Daniel
use with MIT License (MIT)


import os
from apng import APNG

def calsimI1I2(I1, I2):
‘’’ calculate similarity of two images by histogram RMS ‘’’
rms = math.sqrt(sum(map(lambda a,b: (a-b)**2, h1, h2))/len(h1))
return rms

import math
from functools import reduce
import glob
import math, operator
import datetime as dt
from PIL import ImageDraw
from PIL import ImageFont
from PIL import Image, ImageSequence
import time
from images2gif import writeGif

files=sorted(glob.glob(“I:\ipcam*.jpg”), key=os.path.getmtime)

db=[]# list with file informations
for f in files: # go through files
counter += 1

print(“Filelist generated”)
#%% do image comparison
counter = 0
im = APNG()
for i in range(1,N):
draw = ImageDraw.Draw(framenew)
font = ImageFont.truetype(“arial.ttf”, 36)
draw.text((0, 0),time.ctime(mydt), font=font, fill=(255,0,0,255))
del draw
#db[k][‘AnalyzedFlag’]=1 # TODO later
print(‘Similarity’ + str(db[-i][‘S’]))
if res>N:# check max 600
im.append(file, delay=500)
framecounter +=1
if framecounter>30:# 30 frames are enough


writeGif(path+"\res.gif", frames, duration=.65, dither=0)"\res.png")
writeGif(path+"\res.gif", frames, duration=.65, dither=0)"\res.png")
It was just a quick and dirty try to filter the recorded ipcam images, but works nice.


Thanks, ill take a look