From 8c10b15dd81b3a252c87f9ace915ed1d15d59002 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sun, 1 Jan 2023 22:22:23 +0100 Subject: [PATCH] fix color in tradfri --- services/tradfri/bridge.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/services/tradfri/bridge.go b/services/tradfri/bridge.go index 43c8858..e5ac5e4 100644 --- a/services/tradfri/bridge.go +++ b/services/tradfri/bridge.go @@ -175,9 +175,14 @@ func (b *Bridge) refreshDevice(id string, bus *lucifer3.EventBus) { } } - if luciferState.Color != nil && luciferState.Color.XY != nil { - newX := luciferState.Color.XY.X - newY := luciferState.Color.XY.Y + if luciferState.Color != nil { + col, ok := luciferState.Color.ToXY() + if !ok { + return + } + + newX := col.XY.X + newY := col.XY.Y diffX := math.Abs(newX - currX) diffY := math.Abs(newY - currY)