浏览代码

CCT: brightness up/down, temperature up/down

Chris Mullins 8 年之前
父节点
当前提交
d9822cf444
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      lib/MiLight/CctPacketFormatter.cpp

+ 12 - 0
lib/MiLight/CctPacketFormatter.cpp

@@ -158,6 +158,18 @@ void CctPacketFormatter::parsePacket(const uint8_t* packet, JsonObject& result)
     result["state"] = cctCommandToStatus(command) == ON ? "ON" : "OFF";
   }
 
+  if (command == CCT_BRIGHTNESS_DOWN) {
+    result["command"] = "brightness_down";
+  } else if (command == CCT_BRIGHTNESS_UP) {
+    result["command"] = "brightness_up";
+  } else if (command == CCT_TEMPERATURE_DOWN) {
+    result["command"] = "temperature_down";
+  } else if (command == CCT_TEMPERATURE_UP) {
+    result["command"] = "temperature_up";
+  } else {
+    result["button_id"] = command;
+  }
+
   if (! result.containsKey("state")) {
     result["state"] = "ON";
   }