Problem saving ESPHome esp32-cam camera snapshot file

I have a working esp32-cam using ESPHome integrated into HA (HASSIO 0.93.1). I can see videos coming from the camera in the HA UI without problems. But I’m having difficulty storing a snapshot when I called the camera.snapshot service manually via the UI.

I use the following for “service data”:

{
“entity_id”: “camera.esp32cam2”,
“filename”: “/tmp/test.jpeg”
}

Although not sure why I would need this, based on comments I found on this forum, I also added

whitelist_external_dirs:
-/tmp

into my configuration.yaml file.

There’s no error when I clicked “call service,” but when I looked inside directory “/tmp” via the Configurator, the directory is empty. What am I doing wrong?

Try saving it somewhere inside /config, like /config/www/tmp.

1 Like

nickrout - I followed your suggestion and tried storing in the config directory. It worked! Thanks.

Do you know why storing in /tmp failed?

Probably because /tmp is inside your docker container or something. I am a bit vague on docker.

The call-service UI in HA uses /tmp as example (see below), which is why I used it. Talk about misleading documentation.

Take a snapshot from a camera.

Parameter Description Example
entity_id Name(s) of entities to create snapshots from. camera.living_room_camera
filename Template of a Filename. Variable is entity_id. /tmp/snapshot_{{ entity_id }}

Depends on which os you use I suppose

I’m using HASIO, so theoretically things should be relatively straight forward. Unfortunately, what I’m finding is that everything other than the simple vanilla stuff often requires extensive trial and error.

Yes I know you are using hassio.

I’m not able to record to a file. I have a TTGO-Camera setup, it configured and working, but when I created the flow in NodeRed to record upon motion during a given timeframe, I get the following error:

“Call-service API error. Error Message: camera.hall_monitor does not support record service”

Is this related to my TTGO-Camera board, is it unable to record? Not sure how to troubleshoot. Here’s my flow:

…and my call service node:

…and the json code:

{
    "filename": "/config/Recordings/test.mp4",
    "duration": "30"
}

Any thoughts on why I’m seeing the error that the camera doesn’t support record service?

Hello,

I am on HASSIO… I am trying to snapshot from a working ESP32 cam w/ ESPHOME firmware and no imaged saved whatever the filename directory pointed (/config/www/tmp for example)

EDIT : problem solved …

Add the whitelist_external_dirs field in the homeassistant: in configuration.yaml

1 Like

Hi @SeByDocKy, would you be so kind to give me a step by step guide on how to save pictures from my ESP cam, based on event trigger? I use ESP Home and Home Assistant OS. Thx

I did a vidéo in french sometime ago : https://www.youtube.com/watch?v=gVqG13W5MPw