Documentation
¶
Overview ¶
Package alarms follows a camera's own detection state: it holds a Baichuan session subscribed to alarm events (message 31, then 33 pushes) and reports each change -- motion starting or stopping, an object type appearing or going away. It only listens; nothing on the camera changes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Watch ¶
func Watch(ctx context.Context, camera string, dial func(context.Context) (*baichuan.Conn, error), fn func(Change))
Watch follows one camera until ctx ends, reconnecting with backoff, and calls fn for every change. A lost connection ends whatever was on, so a listener is never left believing motion continues.
func WatchLight ¶ added in v0.2.21
func WatchLight(ctx context.Context, camera string, dial func(context.Context) (*baichuan.Conn, error), fn func(Change), light func(camera string, on bool))
WatchLight is Watch that also calls light with the floodlight's state from each floodlight report (291) the camera pushes on the same session: one after login, and one each time the light goes on or off, by command, motion, schedule or the Reolink app. That is the light now, which the page and Home Assistant otherwise only knew as of their last look.