Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.77k stars 1.64k forks source link

MoveToColor (0x07) from Dev Console and MQTT sends the wrong XY values #16405

Closed rechichidaniel closed 1 year ago

rechichidaniel commented 1 year ago

What happened?

Sending the Move to Color (0x07) command sends colorx = 0 and colory = 0 regardless of what colorx and colory are set to. transtime does send.

I tried using these settings for Payload but any values for colox and colory send a 0

{
    "colorx":0.7010,
    "colory":0.2990,
    "transtime":0
}

I also put this json message in a Node Red MQTT node which produced the exact same result.

{
    "command": {
        "cluster": 768,
        "command": 7,
        "payload": {
            "colorx": 0.701,
            "colory": 0.299,
            "transtime": 0
        }
    }
}

What did you expect to happen?

The expectation was for colorx = 0.7010 and colory = 0.2990 to be sent instead of 0.000.

How to reproduce it (minimal and precise)

I used the Z2M Dev Console to send the above command and payload, and Wireshare with nRF52840 to observe the network traffic.

Colour XY not sent

Colour XY not sent transition 1s

Zigbee2MQTT version

1.29.2

Adapter firmware version

20220219

Adapter

TubeZB's CC2652P2 Based Coordinator

Debug log

See screenshots.

Debug 2023-01-29 15:27:53Publishing 'set' 'command' to 'Z2M Test Light'
Info 2023-01-29 15:27:53Invoked '768.7' with payload '{"colorx":0.701,"colory":0.299,"transtime":0}'
rechichidaniel commented 1 year ago

I'm not sure why but the Home Assistant Dev Tools menu does send the correct XY values. It's just the Z2M dev console and direct MQTT messaging that doesn't. Did I set something in my tests up wrong?

HA Dev Tools

Koenkk commented 1 year ago

The datatype of x/y is a uint16, not a float. Multiply the float by 65535 and round it.

rechichidaniel commented 1 year ago

Thanks Koen. That worked. Sorry to waste your time on this one.