Unable to save camera snapshot

I have Hass.io installed in container on a linux Ubuntu machine
Installation folder /usr/share/hassio/homeassistant
I am tryng to configure a snapshot for a camera but every time I run the service receive error no access to path!
The only time I don’t recevie error is if I specify path /tmp , but no file is saved in /usr/share/hassio/tmp

I tryed to add a folder to whitelist

  customize: !include customize.yaml
  whitelist_external_dirs:
    - /tmp  
    - /usr/share/hassio/homeassistant/New folder

but /tmp no error and not file saved
/usr/share/hassio/homeassistant/New folder not a directory @ data[‘whitelist_external_dirs’][0

Camera setting is as follow

camera:      
  - platform: generic
    name: cancello
    still_image_url: "http://192.168.0.112/cgi-bin/snapshot.cgi"
    stream_source: "rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=00"
    username: admin
    password: pass    

If I go with a browser to http://192.168.0.112/cgi-bin/snapshot.cgi I required to login and the I can see the snapshot
I am going crazy :slight_smile:Any idea where is my mistake?

1 Like

As there is a space in that path you might have to put it in quotes.

- '/usr/share/hassio/homeassistant/New folder'

Thank you Tom .

  customize: !include customize.yaml
  whitelist_external_dirs:
    - '/usr/share/hassio/homeassistant/New folder'

same error not a directory @ data[‘whitelist_external_dirs’][0]

Check if the file is saved in /tmp inside the docker container (when you dont recevie error).

Thank you for answering me I can’t understand well how docker and linux manage files and folder.
Just for be sure I made a locate search for snapshot.jpg without find the file…
I tried many folder in whitelist_external_dirs: all with errors.

If you look inside home-assistants docker container /tmp directory the snapshot will be there, its what happened to me.
Try:

docker exec -it homeassistant /bin/bash

Do you have a www directory in your home assistant config folder?
Try creating a folder there called snapshots or whatever.
If it doesnt work try whitelisting the folder.
In my case i had to whitelist /config and its working:

  whitelist_external_dirs:
    - /config/www
2 Likes

Thank you very much that did the trick!

Hi, i have identical configuration as yours. I am running home assistant installed in container on ubuntu machine. Everytime i try to run camera.snapshots service, i got this error

Failed to call service camera/snapshot. a bytes-like object is required, not 'NoneType'

Here is the service i try to call

data:
  filename: '/config/snapshots/yourcamera_{{ now().strftime("%Y%m%d-%H%M%S") }}.jpg'
entity_id: camera.cctv_depan
service: camera.snapshot

I’ve already add /config/snapshots to whitelist in the configuration.yaml file but still this error happens. Do you have any idea to figure this out? Thanks.

ust add to your camera verify_ssl: false

camera:

  • platform: generic
    name: xxx
    still_image_url: “xxx”
    stream_source: “xxx”
    verify_ssl: false

Hi guys,

I just followed your guide to set the whitelist folder and update the verify_ssl but still unable to capture the correct snapshot.

The snapshot file is created sucessfully in the folder but the size is only 14 bytes. The content in the created file is just “404: Not Found.”
Is there any one who got this same issue and solution?

Thank you.

1 Like