Problem Saving Camera Snapshots

Hi,

Solved: by using /media instead of /tmp

I’m trying to create an automation to take a picture and send it as a notification to my phone when my entrance door opens. (door sensor).

To do so, I’m trying to take a snapshot. Save it in the /tmp/snapshots folder and get it from there when the notification is generate. The problem is that I can’t figure out how to save the snapshot. When I run the actions, home assistant says “action ran successfully”, but nothing is being saved in the snapshots folder.

I have set /tmp and /tmp/snapshots to 777, but that didn’t change anything.
I have also added /tmp/snapshots to allowlist_external_dirs

Since it’s not giving me any error, I’m not sure what to do next.

Any help would be really appreciated.

Thank you

Here is my yaml code for the automation;

- id: "1656279294449"
  alias: Entrance Snapshot
  description: ""
  trigger:
    - type: opened
      platform: device
      device_id: 69392729e1adfaed546201ba9f839ff3
      entity_id: binary_sensor.lumi_lumi_sensor_magnet_aq2_161be107_on_off
      domain: binary_sensor
  condition: []
  action:
    - service: camera.snapshot
      data:
        filename: /tmp/snapshots/entranceSnapshot.jpg
      target:
        entity_id: camera.camera1_mediaprofile_channel1_mainstream
  mode: single

Here is my camera onvif config:

"data": {
    "config": {
      "entry_id": "56768d5aa6711ee4059fe874c0646465",
      "version": 1,
      "domain": "onvif",
      "title": "Camera1 - 9c:8e:cd:18:90:4f",
      "data": {
        "name": "Camera1",
        "host": "**REDACTED**",
        "port": 80,
        "username": "**REDACTED**",
        "password": "**REDACTED**",
        "snapshot_auth": "digest"

Here is my configuration.yaml:

homeassistant:
  internal_url: "http://homeassistant-local.ootechnologies.ca:8123"
  external_url: "https://homeassistant.ootechnologies.ca"
  allowlist_external_dirs:
    - /tmp/snapshots

I used to be able to store snapshots but since the latest Hassio update I longer can’t. I used to save them in www/camera_snapshot.

Anyone still has this working? Mine just never saves anything.

So looks like there were no solution to the question. I had a similar issue trying to save snapshots in tmp. Script runs with success but no file in the directory. As I was browsing other Q&A, I saw someone storing its snapshot in the following directory:
filename: ‘/config/www/tmp/test_snapshot.jpg’

Now the script runs still successfully but now leaves a snapshot jpeg file. Looks like although security on tmp directory was opened, HA does not allow file creation in some of its system directories…
Can’t see where there is such a safety limitation and can’t see why there were no exceptions nor log entries in the script execution…

Edit 2024-07-17 - So I just installed Samba in HA as well as on one of my Raspberry PI and now pictures are well saved in the share directory I created.