it has the trappings of a driver now, but essential features are missing: discovery and forgetting
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-02-15 22:31:51 +01:00
parent 73e6cba770
commit 107b29620d
8 changed files with 732 additions and 48 deletions
+16 -6
View File
@@ -20,20 +20,30 @@ func main() {
j, _ := json.Marshal(bridge.GenerateDevices())
fmt.Println(string(j))
for _, device := range bridge.GenerateDevices() {
ch := make(chan models.Event)
go func() {
for event := range ch {
log.Println("EVENT", event.Name, event.Payload)
}
}()
for i, dev := range bridge.GenerateDevices() {
device := dev
switch device.InternalID {
case "6d5a45b0-ec69-4417-8588-717358b05086":
c, _ := models.ParseColorValue("xy:0.22,0.18")
device.State.Color = c
device.State.Intensity = 1
bridge.Update(device)
device.State.Intensity = 0.3
case "a71128f4-5295-4ae4-9fbc-5541abc8739b":
c, _ := models.ParseColorValue("k:2000")
c, _ := models.ParseColorValue("k:6500")
device.State.Color = c
device.State.Intensity = 0.2
bridge.Update(device)
}
device.ID = i + 1
bridge.Update(device)
}
fmt.Println(bridge.MakeCongruent(context.Background()))
err = bridge.Run(context.Background(), ch)
log.Println(err)
}