Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

DaniW42/motioneye-telegram

Repository files navigation

Header Image

Gitter

🎥📱 MotionEye-Telegram

⚠️ Deprecation notice ⚠️

This project started as a problem solver for ourself and did his job very well. Unfortunately, as things move on, development has stopped a long time ago. This is why it is officially being archived. There is a chance that it will continue to work for some people. If you like it - good. If it doesn't work - Sorry for wasting your time, feeling bad for you.


❤️ Contribute!

We noticed that people are really using motioneye-telegram, that is awesome. If you encounter any problems or can't find something you are searching for, feel free to start a discussion, contact us (of course) via Telegram or by adding an issue. Any ideas are welcome!

⚡ Features

  • send latest n snapshots and video via telegram
  • presence-check (you are not at home by pinging one or more eg. smartphones)
  • no port forwardings or open ports required (443 outbound must be possible)
  • no telegram-bot installation required
  • ! currently there are some problems with wifi-devices in energy saving mode, any help appreciated.

📋 Prerequisites

For these scripts to run, you have to ensure that your environment meets the follwing prerequisites:

  • Minimum, by motioneye supported, Raspberry Pi (SBC)
  • Raspberry Pi OS Version Buster (Debian 10) or higher
  • latest motioneye installed
  • tested with motion Version 4.4.0 and motionEye Version 0.42.1
  • somehow fixed IP Adress for your smartphone(s) or other devices

🤖 Bot-Creation

create a new telegram-bot
  • look for @botfather in telegram and open a chat
  • enter the following command and follow the wizard for creation
    /newbot
    
  • write down your HTTP API KEY
get your chat-id:
  • start a conversation with @jsondumpbot.
  • this will return a json-styled message to you which includes your chat-id:
  • for example:
    "chat": {
      "id": <your chat id, eg. 321654987>,
      (... some more content ...)
    },
    
  • take note of your chat-id and save it alongside your http api key
privacy activation
  • details can be found here
  • send the following command to @botfather to use some more privacy
    /setprivacy
    
more telegram commands:
  • you can enter these into telegram if you want to
    /setdescription - changes the bot-description
    /setabouttext - changes the bot-about-description
    /setuserpic - changes the photo in your bot-profile
    

⌨️ installation of motioneye-telegram

  • go to your home directory on your raspberry pi
    cd ~
  • install prerequisites
    sudo apt install -y arping tree git
  • download all the files from github
    git clone https://github.com/DaniW42/motioneye-telegram.git
  • start the installation script
    cd motioneye-telegram
    ./install-tg.sh
install the cronjob for presence check

to install the cronjob for presence check we have to run install-cron.sh as root (using sudo).

as we should never run unknown scripts as root, we kindly invite you to take a sneek peak at install-cron.sh before continuing. to install the cronjob (which runs bin/presencecheck.sh every minute):

  • start the installation script and carefully read the instructions given
    sudo ./install-cron.sh

🚀 using motioneye-telegram as motioneye notification

  • toggle Still Images on and select Capture Mode
  • toggle Movies on and select Recording Mode
  • look for your script path and enter it in motioneye ("run an end command" in "motion notification") e.g. /home/pi/motioneye-telegram/bin/motion-send.sh %$ %t
  • %$ important because it passes the camera name to the script
  • %t important because it passes the camera id to the script

Made with ❤️ in Bavaria 🍻
follow on Twitter follow on Twitter