diff --git a/cmd/lifx/light.go b/cmd/lifx/light.go index 6f8f4d3..e80d9ff 100644 --- a/cmd/lifx/light.go +++ b/cmd/lifx/light.go @@ -142,7 +142,7 @@ func lightList(c *cobra.Command, args []string) { func getLights() []common.Light { var lights []common.Light - logger.WithField(`ids`, flagLightLabels).Debug(`Requested IDs`) + logger.WithField(`ids`, flagLightIDs).Debug(`Requested IDs`) logger.WithField(`labels`, flagLightLabels).Debug(`Requested labels`) if len(flagLightIDs) > 0 { diff --git a/protocol/v2.go b/protocol/v2.go index 49336d6..a7e41d3 100644 --- a/protocol/v2.go +++ b/protocol/v2.go @@ -537,6 +537,7 @@ func (p *V2) process(pkt *packet.Packet, addr *net.UDPAddr) { } p.wg.Add(1) p.deviceQueue <- dev + p.wg.Done() default: if pkt.GetTarget() == 0 { common.Log.Debugf("Skipping packet without target") @@ -613,7 +614,6 @@ func (p *V2) removeGroup(id string) { func (p *V2) addDevices() { for dev := range p.deviceQueue { p.addDevice(dev) - p.wg.Done() // Perform state discovery on lights if l, ok := dev.(*device.Light); ok { if err := l.Get(); err != nil { diff --git a/protocol/v2/device/device.go b/protocol/v2/device/device.go index 5993542..e2cc242 100644 --- a/protocol/v2/device/device.go +++ b/protocol/v2/device/device.go @@ -198,7 +198,7 @@ func (d *Device) SetStateLabel(pkt *packet.Packet) error { if err := pkt.DecodePayload(&l); err != nil { return err } - common.Log.Debugf("Got label (%d): %v", d.id, l.Label) + common.Log.Debugf("Got label (%d): %v", d.id, string(l.Label[:])) newLabel := stripNull(string(l.Label[:])) if newLabel != d.CachedLabel() { d.Lock() @@ -380,10 +380,6 @@ func (d *Device) CachedPower() bool { } func (d *Device) SetPower(state bool) error { - if state && d.CachedPower() { - return nil - } - p := &payloadPower{} if state { p.Level = math.MaxUint16 diff --git a/protocol/v2/device/light.go b/protocol/v2/device/light.go index 2b75ecc..549dc10 100644 --- a/protocol/v2/device/light.go +++ b/protocol/v2/device/light.go @@ -145,10 +145,6 @@ func (l *Light) CachedColor() common.Color { } func (l *Light) SetPowerDuration(state bool, duration time.Duration) error { - if state != l.CachedPower() { - return nil - } - p := new(payloadPowerDuration) if state { p.Level = math.MaxUint16