瀏覽代碼

Fix bug where commands containing transition field and a status/brightness field would generate conflicting transitions

Christopher Mullins 6 年之前
父節點
當前提交
b90c66979e
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      lib/MiLight/MiLightClient.cpp

+ 7 - 1
lib/MiLight/MiLightClient.cpp

@@ -318,7 +318,13 @@ void MiLightClient::update(JsonObject request) {
 
   // Always turn on first
   if (parsedStatus == ON) {
-    if (transition == 0) {
+    if (
+         transition == 0
+      // Do not generate a transition if a brightness field is also set, since that will also
+      // generate a transition.
+      || request.containsKey(GroupStateFieldNames::BRIGHTNESS)
+      || request.containsKey(GroupStateFieldNames::LEVEL)
+    ) {
       this->updateStatus(ON);
     } else {
       handleTransition(GroupStateField::STATUS, status, transition);