Hello,
My setup:
Home Assistant Core
Home Assistant 2022.9.6 Frontend 20220907.2 - latest
Running in a RPi 3 Model B+ (armv7l) (DietPi v8.9.2, Debian 11 Bullseye)
I’m trying to run a bash script that records 5 seconds of video when invoked in Home Assistant via the shell command integration
/home/homeassistant/pivideo.sh
-rwxr-xr-x 1 homeassistant homeassistant 322 Sep 26 21:35 pivideo.sh
root@DietPi:/home/homeassistant# cat pivideo.sh
#!/bin/bash
raspivid -o videorecording.h264 -t 1000
When run from the command line, it works perfect.
In
/home/homeassistant/.homeassistant/configuration.yaml
shell_command:
shell_record_video: bash pivideo.sh
When running the service (Call Service button) from Home Assistant > Developer Tools > Services > Shell Command: shell_record_video
the button turns green with OK tick. However, no .h264 file is created.
If
touch $(date +%F)_$(date +%H-%M-%S).txt
is added to pivideo.sh running the service will create the file in
/home/homeassistant
-rw-r–r-- 1 homeassistant homeassistant 0 Sep 26 21:42 2022-09-26_21-42-26.txt
So running touch is ok but it seems there is some issue with raspivid? My guess is it may have to do with character escaping or variable expansion at bash level.
Any advice on how to get Home Assistant to run the bash script so that raspivid may create the video recording is really welcome.
Thank you in advance.