]> git.basschouten.com Git - openhab-addons.git/commitdiff
[Hueemulation] Fix xy change response (#10692)
authorFlole998 <Flole998@users.noreply.github.com>
Sat, 11 Dec 2021 10:35:33 +0000 (11:35 +0100)
committerGitHub <noreply@github.com>
Sat, 11 Dec 2021 10:35:33 +0000 (11:35 +0100)
Signed-off-by: Flole <flole@flole.de>
bundles/org.openhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/dto/response/HueSuccessResponseStateChanged.java
bundles/org.openhab.io.hueemulation/src/test/java/org/openhab/io/hueemulation/internal/rest/LightsAndGroupsTests.java

index 06ef0d4516fbb8bf4f199e8107275854909f488f..f921dded316825ed37f9c09b8785377de079a2d8 100644 (file)
@@ -13,7 +13,9 @@
 package org.openhab.io.hueemulation.internal.dto.response;
 
 import java.lang.reflect.Type;
+import java.util.List;
 
+import com.google.gson.Gson;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonSerializationContext;
@@ -65,6 +67,9 @@ public class HueSuccessResponseStateChanged extends HueSuccessResponse {
             if (product.value instanceof String) {
                 jObj.addProperty(product.relURI, (String) product.value);
             }
+            if (product.value instanceof List) {
+                jObj.add(product.relURI, new Gson().toJsonTree(product.value));
+            }
             return jObj;
         }
     }
index 5a86a0fe5123edb97951a490b8970bfa57bbd3c4..2d23689800a6b9ba98b741f447bc07649c7ca6eb 100644 (file)
@@ -306,6 +306,7 @@ public class LightsAndGroupsTests {
                 .put(Entity.json(body));
         assertEquals(200, response.getStatus());
         assertThat(response.readEntity(String.class), containsString("success"));
+        assertThat(response.readEntity(String.class), containsString("xy"));
         assertThat(((HueStateColorBulb) cs.ds.lights.get("2").state).on, is(true));
         assertThat(((HueStateColorBulb) cs.ds.lights.get("2").state).bri, is(200));
         assertThat(((HueStateColorBulb) cs.ds.lights.get("2").state).xy[0], is(0.5119));