Frigatier

package module
v0.0.0-...-91660cc Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 12 Imported by: 0

README

Frigatier

A dead-simple utility that reads Frigate notifications over MQTT and pipes them to a messenger of choice.

Currently supported messengers:

  1. Slack
  2. Discord

To run this, you need to either download or compile the binary and then create a config.yml file next to the binary:

frigate:
  host: <frigate IP>
  port: <frigate port>
  
mqtt:
  host: <mqtt IP>
  port: <mqtt port>

messengers:
  slack:
    enabled: True
    token: <slack token>
    channel: <channel ID>

  discord:
    enabled: True
    token: <discord bot token>
    channel: <channel or user id>

This is a very VERY early release. Your cat might be consumed by black holes.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Frigate    Frigate                `yaml:"frigate"`
	Mqtt       Mqtt                   `yaml:"mqtt"`
	Messengers NotificationMessengers `yaml:"messengers"`
}

func NewConfig

func NewConfig() *Config

type Detection

type Detection struct {
	BeforeDetection TimedDetection `json:"before"`
	AfterDetection  TimedDetection `json:"after"`
	Type            string         `json:"type"`
}

type Discord

type Discord struct {
	// contains filtered or unexported fields
}

func NewDiscordMessenger

func NewDiscordMessenger(d DiscordConfig) *Discord

func (*Discord) IsEnabled

func (d *Discord) IsEnabled() bool

func (*Discord) Name

func (d *Discord) Name() string

func (*Discord) Notify

func (d *Discord) Notify(msg *Detection, image string) error

type DiscordConfig

type DiscordConfig struct {
	Enabled      bool   `yaml:"enabled"`
	SendSnapshot bool   `yaml:"send_snapshot"`
	Token        string `yaml:"token"`
	Channel      string `yaml:"channel"`
}

type Frigate

type Frigate struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

type Frigatier

type Frigatier struct {
	// contains filtered or unexported fields
}

func NewFrigatier

func NewFrigatier() *Frigatier

func (*Frigatier) EventHandler

func (f *Frigatier) EventHandler(client mqtt.Client, msg mqtt.Message)

func (*Frigatier) Run

func (f *Frigatier) Run()

type Messenger

type Messenger interface {
	Name() string
	Notify(*Detection, string) error
	IsEnabled() bool
}

type Mqtt

type Mqtt struct {
	Host        string `yaml:"host"`
	Port        int    `yaml:"port"`
	TopicPrefix string `yaml:"topic_prefix"`
	User        string `yaml:"user"`
	Password    string `yaml:"password"`
}

type NotificationMessengers

type NotificationMessengers struct {
	Slack   SlackConfig   `yaml:"slack"`
	Discord DiscordConfig `yaml:"discord"`
}

type Slack

type Slack struct {
	// contains filtered or unexported fields
}

func NewSlackClient

func NewSlackClient(s SlackConfig) *Slack

func (*Slack) IsEnabled

func (s *Slack) IsEnabled() bool

func (*Slack) Name

func (s *Slack) Name() string

func (*Slack) Notify

func (s *Slack) Notify(msg *Detection, image string) error

type SlackConfig

type SlackConfig struct {
	Enabled      bool   `yaml:"enabled"`
	SendSnapshot bool   `yaml:"send_snapshot"`
	Token        string `yaml:"token"`
	Channel      string `yaml:"channel"`
}

type TimedDetection

type TimedDetection struct {
	Id              string    `json:"id"`
	Camera          string    `json:"camera"`
	FrameTime       float64   `json:"frame_time"`
	SnapshotTime    float64   `json:"snapshot_time"`
	Label           string    `json:"label"`
	SubLabel        *string   `json:"sub_label"`
	TopScore        float64   `json:"top_score"`
	FalsePositive   bool      `json:"false_positive"`
	StartTime       float64   `json:"start_time"`
	EndTime         *float64  `json:"end_time"`
	Score           float64   `json:"score"`
	Box             []int     `json:"box"`
	Area            int       `json:"area"`
	Ratio           float64   `json:"ratio"`
	Region          []int     `json:"region"`
	Stationary      bool      `json:"stationary"`
	MotionlessCount int       `json:"motionless_count"`
	PositionChanges int       `json:"position_changes"`
	CurrentZones    []*string `json:"current_zones"`
	EnteredZones    []*string `json:"entered_zones"`
	HasClip         bool      `json:"has_clip"`
	HasSnapshot     bool      `json:"has_snapshot"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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