[Camera snapshot] Error : Can't write '/tmp/xxxx.jpg', no access to path!

Hello, :wink:

I can not configure camera snapshots :frowning:
I use HA v 0.65 on hassio (Raspberry pi 3)

Here is the configuration :

homeassistant:
...
whitelist_external_dirs:
- /tmp     

When I test the service using :

{
ā€œentity_idā€: ā€œcamera.dlinkā€,
ā€œfilenameā€: ā€œā€˜/tmp/dlink.jpgā€™ā€
}

I have this error :

Canā€™t write ā€˜/tmp/dlink.jpgā€™, no access to path!

I restarted, but I still have the same problem

Iā€™m having exactly the same problem since updating to 0.65.2 this morning.

camera.snapshot was working fine until the update (previous version 0.64), now Iā€™m also getting the ā€˜no access to path!ā€™ error.

Checked permissions to see if something had changed, also tried creating a new folder, but I can;t seem to get it to work.

Try reverting to 0.64 to check. If you can confirm, this might be something to report on github.

hmmm, I tried reverting. All seems to go well, ends with ā€˜Successfully installed homeassistant-0.64.0ā€™ but the HomeAssistant info page is still showing 0.65.2

Tried clearing cache, using a different browser etc. Is there something else I can do to make sure I have the previous version? The problem persists after reverting, so Iā€™d like to be sure which version is running.

Edit: Forgot to add that I also rebooted the RaspberryPi, to make suren everything was reset.

Look if you can rename entity directly in the UI ? If yes, youā€™re in 0.65

I tried again this morning and it worked first try, I must have done something wrong yesterday. (I was really tiredā€¦) I first updted to 0.65.3 to see if that fixed the ā€˜no access to pathā€™ problem, but no go.

Anyway, reverting to version 0.64.0 fixed the problem, camera.snapshot is working again. Will report on github.

Some more info, after testing with 0.64.0 I upgraded to 0.64.3 and the problem returned. After downgrading again to 0.64.2 it worked again.

Seem to be related to a fix in the 0.64.3 release: (is_allowed_path: Also test folder #12788 #12807 (@kellerza - #12810)

Hello,

Thank you for the issue reporting mvdarend.

Kellerza has just answered but I admit I donā€™t understandā€¦ To be continued :slight_smile:

Also experiencing this issue. Was working fine in 0.59.2 for me.
It stopped working for me when I upgraded from 0.59.2 to 0.63.1
Iā€™m now at 0.65.3 and still have the issue ā€œno access to pathā€.

:thinking:

Do you have any other solution to send camera snapshot to a telegram notification ?

@luca-angemi posted a workaround:

Found a workaround while it gets fixed: create a file with the same name of the snapshot in the same folder.
The camera.snapshot service wonā€™t throw an error and your file will be overwritten.

Hello,

@mvdarend Iā€™m not lucky, this tip doesnā€™t work for me :frowning:
Am I wrong somewhere ?

Manually created file :

/tmp/dlink.jpg

Whitelist :

  whitelist_external_dirs:
    - /tmp

Service :

{
  "entity_id": "camera.dlink",
  "filename": "'/tmp/dlink.jpg'"
}  

Error :

Canā€™t write ā€˜/tmp/dlink.jpgā€™, no access to path!

Iā€™m not sure, I havenā€™t tried it myself yet. Two small things that may help:

My whitelist_external_dirs looks like this: (with trailing slash)

whitelist_external_dirs: /tmp/

Iā€™m probably wrong, but do you need the double and single quotes in this line?

"filename": "'/tmp/dlink.jpg'"

I have changed my ā€˜whitelist_external_dirsā€™ like yours, same effect.

In the ā€œservices testā€ for dev :
If I donā€™t mark double quotes : I have an json editor error.
If I and donā€™t mark single quotes, the service hasnā€™t any effects.

Here is my automation :

- data:
      entity_id: camera.dlink
      filename: '/tmp/dlink.jpg'
    service: camera.snapshot

But I have the same error " canā€™t access to path" :frowning:

I have just upgraded to 0.65.4 and the workaround works for me. After creating the files as mentioned by @luca-angemi it works, if I remove them I get the ā€˜No access to path!ā€™ error.

Have you checked your permissions? I have given the HomeAssistant user full acces to the /tmp/ folder, and also the files that need to be overwritten.

I donā€™t know how to edit permissions :anguished:

It is on samba share plugin settings ?

Edit : I use hassio on Raspberry pi 3

Thank you @mvdarend

Iā€™m not sure how it works with Hassio. I have Hassbian running and use WinSCP to manage the files on the Raspberry Pi.

If youā€™re also using WinSCP all you have to do is navigate to the folder right-click ā†’ Options and give the HomeAssistant user sufficient privileges.

Iā€™m not well versed in Linux, so I canā€™t really explain it well. If it doesnā€™t work then hopefully someone more knowledgeable can help .

Ok, thank you.

The subject to slightly derived, I will create a new topic.

The workaround is useless to some of us.

I have an automation that saves a snapshot from 2 different security cameras when motion is detected.
Saving the files to:
www/motion/front_porch_yyyymmdd_hhmmss.png
www/motion/driveway_yyyymmdd_hhmmss.png

Is there a workaround for variable filenames?
Is there an ETA for a full fix?
Iā€™m at 0.65.3 currently.

Same problem here with 0.69
Anyone has figured this out and could you post your working scripts?

2 Likes