STEP-BY-STEP SOLUTION
For all who also struggle on this, took me now 4 hours to get a solution for HOME ASSISTANT SUPERVISED (no docker, no HA-OS, …)
ffmpge musst be installed
sudo apt-get install ffmpeg
create a script directory
sudo mkdir /usr/share/hassio/homeassistant/script
create a script in the directory
sudo nano /usr/share/hassio/homeassistant/script/update_cam_still_image.sh
past the following code to the script (replace the variables , with your values. Also replace the output filename (still_image.jpg) with one you like. Note: The output directory is a relativ path to Home Assistant config folder, so it starts with www/images/ (don’t know why they made this so confusing… absolut paths would be better, but they choose this solution)
/usr/bin/ffmpeg -y -loglevel fatal -rtsp_transport tcp -i rtsp://<user>:<password>@<camera-url> -frames:v 2 -r 1 -s 1280x720 www/images/still_image.jpg
make the shell script executable
sudo chmod +x /usr/share/hassio/homeassistant/script/update_cam_still_image.sh
create a images directory
sudo mkdir /usr/share/hassio/homeassistant/www/images
create a shell script yaml file. (I do my config in separate files)
sudo nano /usr/share/hassio/homeassistant/shell_command.yaml
past this code to the yaml file. (NOTE there are empty spaces before first char! It is also very confusing, that the path is relativ to /usr/share/hassio/homeassistant. Don’t know why they choose the way not to use absolut paths.)
cam_still: /config/script/update_cam_still_image.sh
edit configuration.yaml and add the following (can be done by UI or if you prefer also using nano)
shell_command: !include shell_command.yaml
restart homeassistant (can be done from the UI)
create an automation to update the image every 5 seconds. This can also be done by UI. Create a new automation.
Select “Time pattern” as trigger.
Hours: *
Minutes: *
Seconds: /5
As Action use “Call a service” and select the “shell_command.cam_still”
OR if you prefer, here is the yaml script for the automation:
alias: Camera Update Still
description:
Runs a shell script, which updates the still image for the camera and saves it to
/usr/share/hassio/homeassistant/www/images/
The picture can be used in a generic camera using the following URL
http://localhost/local/images/still_image.jpg
trigger:
- platform: time_pattern
seconds: /5
hours: "*"
minutes: "*"
condition: []
action:
- service: shell_command.cam_still
data: {}
mode: single