Переглянути джерело

status -> state (for HomeAssistant compatibility)

Chris Mullins 8 роки тому
батько
коміт
6621621b80

+ 1 - 1
lib/MiLight/CctPacketFormatter.cpp

@@ -155,7 +155,7 @@ void CctPacketFormatter::parsePacket(const uint8_t* packet, JsonObject& result)
 
   uint8_t onOffGroupId = cctCommandIdToGroup(command);
   if (onOffGroupId < 255) {
-    result["status"] = cctCommandToStatus(command) == ON ? "on" : "off";
+    result["state"] = cctCommandToStatus(command) == ON ? "ON" : "OFF";
   }
 }
 

+ 2 - 2
lib/MiLight/RgbCctPacketFormatter.cpp

@@ -125,10 +125,10 @@ void RgbCctPacketFormatter::parsePacket(const uint8_t *packet, JsonObject& resul
   if (command == RGB_CCT_ON) {
     // Group is not reliably encoded in group byte. Extract from arg byte
     if (arg < 5) {
-      result["status"] = "on";
+      result["state"] = "ON";
       result["group_id"] = arg;
     } else {
-      result["status"] = "off";
+      result["state"] = "OFF";
       result["group_id"] = arg-5;
     }
   } else if (command == RGB_CCT_COLOR) {

+ 2 - 2
lib/MiLight/RgbPacketFormatter.cpp

@@ -86,9 +86,9 @@ void RgbPacketFormatter::parsePacket(const uint8_t* packet, JsonObject& result)
   result["device_type"] = "rgb";
 
   if (command == RGB_ON) {
-    result["status"] = "on";
+    result["state"] = "ON";
   } else if (command == RGB_OFF) {
-    result["status"] = "off";
+    result["state"] = "OFF";
   } else if (command == 0) {
     uint16_t remappedColor = rescale<uint16_t, uint16_t>(packet[RGB_COLOR_INDEX], 360.0, 255.0);
     remappedColor = (remappedColor + 320) % 360;

+ 1 - 1
lib/MiLight/RgbwPacketFormatter.cpp

@@ -99,7 +99,7 @@ void RgbwPacketFormatter::parsePacket(const uint8_t* packet, JsonObject& result)
   result["group_id"] = packet[RGBW_BRIGHTNESS_GROUP_INDEX] & 0x7;
 
   if (command >= RGBW_ALL_ON && command <= RGBW_GROUP_4_OFF) {
-    result["status"] = (command % 2) ? "on" : "off";
+    result["state"] = (command % 2) ? "ON" : "OFF";
   } else if (command == RGBW_BRIGHTNESS) {
     uint8_t brightness = 31;
     brightness -= packet[RGBW_BRIGHTNESS_GROUP_INDEX] >> 3;