arlo-go/cmd/main.go

36 lines
613 B
Go
Raw Normal View History

2020-05-27 19:03:26 +00:00
package main
import (
"context"
"git.lehouerou.net/laurent/arlo-go"
log "github.com/sirupsen/logrus"
)
func main() {
ctx := context.Background()
a := arlo.NewArlo()
err := a.Login(ctx, "hass@lehouerou.net", "TiPXMVLUeZfUg6RrmwzK")
if err != nil {
log.Errorf("login: %v", err)
return
}
for _, device := range a.Cameras {
2020-06-08 16:19:08 +00:00
if device.DeviceName == "Salon" {
motionChan, err := device.SubscribeToMotionDetection(ctx)
if err != nil {
log.Errorf("subscribing to motion: %v", err)
return
}
for b := range motionChan {
log.Infof("motion salon %t", b)
}
2020-05-27 19:03:26 +00:00
}
}
select {}
}