Okay thank you very much.
I´ve tasted it and the pictures appear correctly.
However, the videos don´t appear and in the log it appears this:
Error running command:
bash /config/shell_scripts/camara_piscina_shell_script.sh {{cam_token}}, return code: 1
My automation is this:
- alias: esp32_cam
trigger:
- entity_id: media_player.samsung_ue43mu1234
from: 'off'
platform: state
to: 'on'
action:
- data:
entity_id: camera.camara_piscina
filename: /config/www/cam_captures/pisicna_{{ now ().year }}_{{ now ().month }}_{{ now ().day }}_{{ now ().hour }}_{{ now ().minute }}.jpg
service: camera.snapshot
- delay: 00:00:01
- data_template:
data:
force_image: true
image: https://xxxxxx.duckdns.org/local/cam_captures/piscina_{{ now ().year }}_{{ now ().month }}_{{ now ().day }}_{{ now ().hour }}_{{ now ().minute }}.jpg
message: Grabación iniciada
title: Mensaje CAM
service: notify.notify
- service: shell_command.camara_piscina_shell_script
In configuration.yaml:
shell_command:
camara_piscina_shell_script: "bash /config/shell_scripts/camara_piscina_shell_script.sh {{cam_token}}"
In my config/shell_scripts/camara_piscina_shell_script.sh:
#!/bin/bash
exec &>>/config/shell_scripts/camara_piscina.log
date
echo "token is: $1"
cam_token=$1
folder=/config/www/cam_record
id=$(date +"%y-%m-%d_%H-%M-%S")camara_piscina
http_url=http://192.168.XX.XX:8123/api/camera_proxy_stream/camera.camara_piscina?token=$1
mkdir $folder
ffmpeg -i $http_url -t 10 -vcodec copy $folder/$id.mp4
ls -lh $folder/$id.mp4 $folder/camara_piscina.mp4
cp $folder/$id.mp4 $folder/camara_piscina.mp4 ;
Do you know why it doesn´t work? Thank you!