Skip to content

Zigbee Color Dimmable Light - Invalid Saturation #11527

Closed
@thorrak

Description

@thorrak

Board

XIAO ESP32-C6

Device Description

Raw board, disconnected from everything

Hardware Configuration

Raw board, disconnected from everything

Version

latest stable Release (if not listed below)

IDE Name

VSCode + Platformio

Operating System

NA

Flash frequency

NA

PSRAM enabled

yes

Upload speed

115200

Description

When I initialize a Zigbee color dimmable light in code to have a color value of RGB(4, 255, 0), I get an error message when the ZigbeeColorDimmableLight code tries to set the color:

Bus 1: Light change - State: OFF, RGB: (4,255,0), Level: 99
[  6303][E][ZigbeeColorDimmableLight.cpp:180] setLight(): Failed to set light saturation: 0x87: Invalid value

Doing some digging, what it appears is happening is that the function to convert RGB color to HSV color is called as part of setLight, and the results are then passed - unadjusted - to esp_zb_zcl_set_attribute_val. The issue is that espRgbColorToHsvColor can return a saturation value from 0-255, but the valid range for Zigbee is 0-254.

Sketch

Although I have not tested this as I don't have the Arduino IDE, I believe this example should cause the error due to the addition of Line 118 to the stock example:

https://gist.github.com/thorrak/c3e957ed79313b80655e2ab666d662c5

Line 118 is the only line that differs from the stock example.

Debug Message

[  6303][E][ZigbeeColorDimmableLight.cpp:180] setLight(): Failed to set light saturation: 0x87: Invalid value

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

Labels

Area: ZigbeeIssues and Feature Request about Zigbee

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions