Posting Webcam Sapshots to Telegram Group on MotionDetection

Hi folks,

i live in a house in the countryside and want me or friends to get notified about people walking around on my property when i am away for a longer time.

Idea was to post a webcam snapshot to a Telegram group. Normally only me and my girlfriend are group members but we invite friends to the group when we are in holidays or away for some days so they can have a look when strange things are going on.

Implementation was very easy and straightforward and i like to share the basic setup here. If you have any questions about details, feel free to contact me:

Components used:

Item for motion detection:

Switch Bewegung_Eingang "Bewegung Eingang" <motion> (gSecurity) {channel="homematic:HM-Sen-MDIR-O:LEQ0245225:KEQ0195256:1#MOTION"}

Rule that grabs a single image and posts it to Telegram group

rule "Send webcam snapshot when motion detected"
when
   Item Bewegung_Eingang changed from OFF to ON
then
   executeCommandLine("/usr/bin/ffmpeg -y -i http://<webcamIP here>/video2.mjpg -vframes:v 1 /tmp/eingang.jpg", 10000)
   sendTelegramPhoto("group", "file:///tmp/eingang.jpg", "Bewegung Eingangsbereich entdeckt")
end

2 Likes

Do you have any Solution for OH3 ?

executeCommandLine(Duration.ofSeconds(10), "sudo", "/usr/bin/ffmpeg", "-y", "-i", "http://<webcamIP here>/snapshots.mjpeg", "-vframes:v", "1", "/tmp/eingang.jpg")