When dimming a light/bulb over time or changing color the thread network can be spammed (#31778)
* Adding diff
* Restyled by clang-format
---------
Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp
index a21a44a..0f24ccd 100644
--- a/src/app/clusters/color-control-server/color-control-server.cpp
+++ b/src/app/clusters/color-control-server/color-control-server.cpp
@@ -2602,6 +2602,24 @@
isColorTempTransitionDone = computeNewColor16uValue(colorTempTransitionState);
+ if (!isColorTempTransitionDone)
+ {
+ // Check whether our color temperature has actually changed. If not, do
+ // nothing, and wait for it to change.
+ uint16_t currentColorTemp;
+ if (Attributes::ColorTemperatureMireds::Get(endpoint, ¤tColorTemp) != EMBER_ZCL_STATUS_SUCCESS)
+ {
+ // Why can't we read our attribute?
+ return;
+ }
+
+ if (currentColorTemp == colorTempTransitionState->currentValue)
+ {
+ scheduleTimerCallbackMs(configureTempEventControl(endpoint), TRANSITION_UPDATE_TIME_MS.count());
+ return;
+ }
+ }
+
Attributes::RemainingTime::Set(endpoint, colorTempTransitionState->timeRemaining);
if (isColorTempTransitionDone)