|
|
@ -5,7 +5,7 @@ import ( |
|
|
|
"context" |
|
|
|
"flag" |
|
|
|
"fmt" |
|
|
|
"git.aiterp.net/lucifer/new-server/internal/drivers/nanoleaf" |
|
|
|
"git.aiterp.net/lucifer/new-server/app/config" |
|
|
|
"git.aiterp.net/lucifer/new-server/models" |
|
|
|
"log" |
|
|
|
"os" |
|
|
@ -15,7 +15,7 @@ import ( |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
|
var flagDriver = flag.String("driver", "Nanoleaf", "The bridge driver to use") |
|
|
|
var flagDriver = flag.String("driver", string(models.DTNanoLeaf), "The bridge driver to use") |
|
|
|
var flagAddress = flag.String("address", "127.0.0.1", "The bridge's address") |
|
|
|
var flagToken = flag.String("token", "", "The bridge's access token / api key / login") |
|
|
|
var flagPair = flag.Bool("pair", false, "Try to pair with the bridge.") |
|
|
@ -25,8 +25,11 @@ var flagSearchTimeout = flag.Duration("search-timeout", time.Second*3, "Timeout |
|
|
|
func main() { |
|
|
|
flag.Parse() |
|
|
|
|
|
|
|
// TODO: Select driver
|
|
|
|
driver := nanoleaf.Driver{} |
|
|
|
// Find drivers
|
|
|
|
driver, err := config.DriverProvider().Provide(models.DriverKind(*flagDriver)) |
|
|
|
if err != nil { |
|
|
|
log.Fatalln("Failed to find driver:", err) |
|
|
|
} |
|
|
|
|
|
|
|
// Find bridge
|
|
|
|
bridges, err := driver.SearchBridge(context.Background(), *flagAddress, !*flagPair) |
|
|
|