nvr

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 4 Imported by: 0

README

UniFi NVR Motion Detector

Go Report Card

This package monitors the monitor.log file written by the Ubiquiti UniFi NVR, and triggers a callback method whenever motion is detected. You can trigger on either the start of the motion or the end of the motion.

This package was inspired by https://github.com/mzac/unifi-video-mqtt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MotionDetector

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

MotionDetector manages the callbacks for start and stop events.

func DetectMotion

func DetectMotion(motionlog string) (*MotionDetector, error)

DetectMotion starts monitoring the specified motion.log file for motion start and stop events. DetectMotion will return an error if the specified file does not exist. Call AddStartMotionCallback or AddStopMotionCallback to setup callback methods for each camera ID to monitor.

func (*MotionDetector) AddStartMotionCallback

func (md *MotionDetector) AddStartMotionCallback(cameraID string, callback func(string, string))

AddStartMotionCallback adds the specified callback for 'start' motion events.

func (*MotionDetector) AddStopMotionCallback

func (md *MotionDetector) AddStopMotionCallback(cameraID string, callback func(string, string))

AddStopMotionCallback adds the specified callback for 'stop' motion events.

func (*MotionDetector) RemoveStartMotionCallback

func (md *MotionDetector) RemoveStartMotionCallback(cameraID string)

RemoveStartMotionCallback removes the specified callback for 'start' motion events.

func (*MotionDetector) RemoveStopMotionCallback

func (md *MotionDetector) RemoveStopMotionCallback(cameraID string)

RemoveStopMotionCallback removes the specified callback for 'start' motion events.

Jump to

Keyboard shortcuts

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