# Posting Webcam Sapshots to Telegram Group on MotionDetection

**URL:** <https://community.openhab.org/t/posting-webcam-sapshots-to-telegram-group-on-motiondetection/92795>\
**Category:** Tutorials & Examples\
**Tags:** telegram, webcam\
**Created:** [February 14, 2020, 5:15pm UTC](https://community.openhab.org/t/posting-webcam-sapshots-to-telegram-group-on-motiondetection/92795 "2020-02-14T17:15:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RalfWenzel](https://community.openhab.org/user_avatar/community.openhab.org/ralfwenzel/32/49951_2.png) [@RalfWenzel](https://community.openhab.org/u/RalfWenzel)\
**Post date:** [February 14, 2020, 5:15pm UTC](https://community.openhab.org/t/posting-webcam-sapshots-to-telegram-group-on-motiondetection/92795/1 "2020-02-14T17:15:08Z")

</div>

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:**

- openHAB2 running on Ubuntu 18.04 LTS
- [openHAB Telegram Actions AddOn](https://www.openhab.org/addons/actions/telegram/)
- Homematic binding using CCU2 and [HM-Sen-MDIR-O Motion detector](https://de.elv.com/homematic-funk-ir-bewegungsmelder-aussen-hm-sen-mdir-o-2-fuer-smart-home-hausautomation-131777) but any other motion detector should work also.
- IP Webcam (Vivotek IP8633 ) but any webcam delivering a MJPG stream should work also.

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

```

 ![photo_2020-02-12_15-46-40](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/e/0/e077bec64bfea0190af53a183416a95e380cd23a.jpeg)

---

<div class="post-metadata">

**Author:** ![hoerb](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/82dd89/32.png) [@hoerb](https://community.openhab.org/u/hoerb)\
**Post date:** [January 20, 2021, 4:23pm UTC](https://community.openhab.org/t/posting-webcam-sapshots-to-telegram-group-on-motiondetection/92795/2 "2021-01-20T16:23:48Z")

</div>

Do you have any Solution for OH3 ?

---

<div class="post-metadata">

**Author:** ![mancer](https://community.openhab.org/letter_avatar_proxy/v4/letter/m/e95f7d/32.png) [@mancer](https://community.openhab.org/u/mancer)\
**Post date:** [July 19, 2021, 9:31pm UTC](https://community.openhab.org/t/posting-webcam-sapshots-to-telegram-group-on-motiondetection/92795/4 "2021-07-19T21:31:26Z")

</div>

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

```
