@prankousky wrote:
Hi everybody,
I have multiple cameras that I mainly include in notifications (if front gate opens, send telegram message with snapshot from camera x). I want to create an automation to trigger
camera.record
, then send that recording (instead of a picture). Is there a way to determine when the file has actually been written?In other words: let’s say I want to record 120 seconds, then send this recording. How can I make sure that this file is sent, not a previous recording? I thought of
delay: "00:02:00"
, but there must be a better way.My incomplete package looks like this:
binary_sensor: - platform: tod name: Nachtmodus after: "20:45" before: 07:45" automation: trigger: - platform: state entity_id: binary_sensor.draussen_gartentor_contact to: "on" condition: condition: state entity_id: binary_sensor.nachtmodus state: "on" action: - service: camera.record entity_id: camera.cam_einfahrt filename: /config/downloads/cams/einfahrt.mp4
What do I need to add so that I will always get the most recent recording (instead of a previous recording, or an incomplete file)? At first I thought I could use something like
filename: '/tmp/{{ entity_id }}_{{ now().strftime("%Y%m%d-%H%M%S") }}.mp4'
, but the strftime value will be different for the file to what I could use in myservice: notify.all
part of the code, as those wouldn’t be executed at the very same second.I thought of creating a second automation to observe when
camera.cam_einfahrt
's status changes fromrecording
to idle; however, for some reason, even when I call the service to record a file (via developer tools), the camera will be set toidle
, which is weird. I checked after the set period of time: the file will be recorded, so syntax etc. was correct, but the camera entity did not report that it was actually recording.Thank you for your ideas
Posts: 1
Participants: 1