telegram-camera-bridge

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

README

Telegram MotionEye Integration

A stupid little project that takes pictures using a Raspberry Pi Zero every x minutes (or upon a motion REST request) from a MotionEye OS camera and sends it to a Telegram Group.

...why?

docs/noodle_bot.png

So we can watch guinea pigs without having to completely expose a service or set up wireguard. Important stuff, written one bored afternoon.

How

Run

Easy:

  1. Acquire guinea pigs, kids, or other things that need watching and make sure they are happy
  2. Install MotionEye OS on a Raspberry PI and connect a camera; configure it so it sends motion detection is on and "Call a Web Hook" points to the server and port you're running this on (can be the same Raspberry, really)
  3. Customize the config/sample.yaml (see below)
  4. Build and run: go run *.go serve --config ./config/sample.yaml

Config

You will need a bot, which you can get by chatting up @BotFather on Telegram.

Next, add that to a chanel.

Use your bot's bot_name and api_key from that chat.

Next, fire a request as such:

curl --location --request GET 'https://api.telegram.org/YOUR_BOT_KEY/getUpdates'

And grab the ID of the chanel you've added the bot to.

"my_chat_member": {
                "chat": {
                    "id": INT64_ID,
                    "title": "ID",
                    "type": "group",
                    ...

Build & Test

go test ./... -coverprofile coverage.out
go tool cover --html coverage.out 
go build *.go

Docker

CONFIG_FILE=$(pwd)/config/sample.yaml
docker build . -t telegram-motioneye
docker run -d  \
    -p "$(cat $CONFIG_FILE | grep port | cut -d'"' -f2 | xargs)":6060 \
    -v $(pwd)/config:/config \
    telegram-motioneye \
    /app/server serve --config /config/$(basename $CONFIG_FILE)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL