|
|
package main
import ( "fmt" lucifer3 "git.aiterp.net/lucifer3/server" "git.aiterp.net/lucifer3/server/commands" "git.aiterp.net/lucifer3/server/device" "git.aiterp.net/lucifer3/server/events" "git.aiterp.net/lucifer3/server/internal/color" "git.aiterp.net/lucifer3/server/internal/gentools" "git.aiterp.net/lucifer3/server/services" "time" )
func main() { bus := lucifer3.EventBus{}
bus.Join(services.Resolver())
bus.RunEvent(events.Connected{Prefix: "nanoleaf:10.80.1.11"})
time.Sleep(time.Second / 2)
for i, id := range []string{"e28c", "67db", "f744", "d057", "73c1"} { bus.RunEvent(events.HardwareState{ ID: "nanoleaf:10.80.1.11:" + id, InternalName: fmt.Sprintf("Hexagon %d", i+1), SupportFlags: device.SFlagPower | device.SFlagColor | device.SFlagIntensity, ColorFlags: device.CFlagRGB, State: device.State{}, }) }
bus.RunCommand(commands.ReplaceScene{ IDs: []string{"lucifer:name:Hexagon*"}, SceneID: 7, })
time.Sleep(time.Second / 4)
for _, id := range []string{"nanoleaf:10.80.1.11:e28c", "nanoleaf:10.80.1.11:67db", "nanoleaf:10.80.1.11:f744", "nanoleaf:10.80.1.11:d057", "nanoleaf:10.80.1.11:73c1"} { bus.RunCommand(commands.SetState{ ID: id, State: device.State{ Power: gentools.Ptr(true), Intensity: gentools.Ptr(0.75), Color: gentools.Ptr(color.MustParse("xy:0.3209,0.1542")), }, }) }
time.Sleep(time.Second / 2)
bus.RunEvent(events.HardwareState{ ID: "nanoleaf:10.80.1.11:40e5", InternalName: "Hexagon 6", SupportFlags: device.SFlagPower | device.SFlagColor | device.SFlagIntensity, ColorFlags: device.CFlagRGB, State: device.State{}, }) bus.RunCommand(commands.ReplaceScene{ IDs: []string{"lucifer:name:Hexagon*"}, SceneID: 7, })
time.Sleep(time.Second / 4)
bus.RunCommand(commands.SetState{ ID: "nanoleaf:10.80.1.11:40e5", State: device.State{ Power: gentools.Ptr(true), Intensity: gentools.Ptr(0.75), Color: gentools.Ptr(color.MustParse("xy:0.3209,0.1542")), }, })
time.Sleep(time.Second / 4) }
|