Sfoglia il codice sorgente

CCT: brightness up/down, temperature up/down

Chris Mullins 8 anni fa
parent
commit
d9822cf444
1 ha cambiato i file con 12 aggiunte e 0 eliminazioni
  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";
   }