I installed YiHackv4 on a Yi Outdoor (plug-in) the “best” new feature for me is that I can now ftp *.mp4 files off of the camera without the need to remove the SD card.
In configuration.yaml I have specified:
# Yi Outdoor
- platform: ffmpeg
input: -rtsp_transport tcp -i rtsp://cameraIP/ch0_0.h264
name: YiShed
For the Lovelace UI I specified:
Much to my surprise this all works as I had hoped
My next step is to grab a snapshot once an hour (during daylight hours). Taking advice from here, I ssh into my HA server (RPIv4):, but even though ffmpeg is part of the HA install, I can not find the executable command.
[EDIT 1]
It was easier than I expected. I downloaded ffmpeg-release-armhf-static.tar.xz from here.
[EDIT 2]
With ffmpeg installed I found this advice to grab a frame on demand.
Script to grab a frame [MySnaps.sh] and save it in a file “timestamp”.jpg:
#!/bin/sh
export DATETIME=`date +%Y%m%d%H%M%S`
/root/config/ffmpeg/ffmpeg -loglevel fatal -y -rtsp_transport tcp -i rtsp://192.168.210.85/ch0_0.h264 -vframes 1 /root/share/timelapse/$DATETIME.jpg
Invoke the script every 15 minutes from 0900 to 1545 everyday…
In crontab:
`*/15 9-15 * * * /root/config/ffmpeg/MySnaps.sh`
To start crond whenever the Home Assistant server is rebooted:
- in /etc/init.d create “startcron” (chmod +x)
startcron:
#!/bin/sh
/usr/sbin/crond -S -l 0
File list in t timelapse folder looks like:
-rw-r–r-- 1 root root 262743 Oct 31 14:45 20201031144500.jpg
-rw-r–r-- 1 root root 283273 Oct 31 15:00 20201031150000.jpg
-rw-r–r-- 1 root root 228100 Oct 31 15:15 20201031151500.jpg
-rw-r–r-- 1 root root 237435 Oct 31 15:30 20201031153000.jpg
-rw-r–r-- 1 root root 277088 Oct 31 15:45 20201031154500.jpg
-rw-r–r-- 1 root root 212726 Nov 1 09:00 20201101090000.jpg
-rw-r–r-- 1 root root 222943 Nov 1 09:15 20201101091500.jpg
-rw-r–r-- 1 root root 262867 Nov 1 09:30 20201101093000.jpg
-rw-r–r-- 1 root root 271370 Nov 1 10:00 20201101100000.jpg
Now I’ll let it run and watch the grass grow…
[EDIT 3] After upgrading from HA Core 0.116.2 → 0.117.2 and OS 4.13 → 4.15 I had to re-do the “startcron” change in /etc/init.d AND the crontab entry shown above.