camerabot

package module
Version: v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2018 License: MIT Imports: 5 Imported by: 2

README

camerabot

Build Status Go Report Card GoDoc

Building

You need to get sources and cross-compile them for ARM architecture. These can be easily done by these commands, assuming you have Go installed.

  1. go get github.com/cooldarkdryplace/camerabot
  2. env GOOS=linux GOARCH=arm go build -v github.com/cooldarkdryplace/camerabot/cmd/camerabot

As a result you will have binary suitable for running on Raspberry Pi. Copy it on device and proceed.

Software

Telegram bot that makes a photo and sends it to chat.

I use this bot to monitor kiln temperature and make sure workshop is not on fire yet. Go part is responsible for interacting with Telegram API. Application uses long polling because in my case device is located behind two NATs. Uses raspistill (via os.exec) to make photos. Parametrized commands for raspistill are stored in external bash scripts.

Running bot
  1. Setup Raspberry Pi and Pi camera.
  2. Set environment variable TOKEN with your bot token (Botfather can provide you with the one).
  3. Use systemd config to start as a service or simply run the app from the console.
  4. Start direct conversation with bot or add bot to group chat if you are interested in broadcasting your kiln paranoia.
Commands
  1. /pic sends ordinary photo.
  2. /zoom sends zoomed and croped region of interest. Kiln controller in my case.
Examples

pic processing result another pic result zoom result

Hardware

Currently runs on a Raspberry Pi. Using onboard V2 camera.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// MainChatID refers to chat where camerabot will send error reports.
	MainChatID int64

	// CacheDir is a path to dorectory where last photos are stored.
	CacheDir string
)
View Source
var Handlers = make(map[string]Handler)

Handlers implement commands that are executed by bot. Unknown commands ignored.

Functions

func ListenAndServe

func ListenAndServe()

ListenAndServe gets updates and processes them.

Types

type Handler

type Handler interface {
	// Command name supported by handler.
	Command() string
	// Handle supported command.
	Handle(chatID int64) error
	// Help message. Help handler will show it.
	Help() string
}

Handler processes command sent to bot.

Source Files

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL