36 lines
620 B
Go
36 lines
620 B
Go
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 {
|
|
err := device.RefreshState(ctx)
|
|
if err != nil {
|
|
log.Errorf("%v", err)
|
|
}
|
|
}
|
|
|
|
for _, device := range a.Cameras {
|
|
if device.DeviceName == "Salon" {
|
|
motionChan := device.SubscribeToMotion()
|
|
for b := range motionChan {
|
|
log.Infof("motion salon %t", b)
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|