Skip to content

Commit

Permalink
[Hueemulation] Fix xy change response (openhab#10692)
Browse files Browse the repository at this point in the history
Signed-off-by: Flole <flole@flole.de>
  • Loading branch information
Flole998 committed Dec 11, 2021
1 parent e58647a commit 7dd947a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -65,6 +67,9 @@ public JsonElement serialize(HueSuccessResponseStateChanged product, Type type,
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;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ public void switchOnWithXY() {
.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));
Expand Down

0 comments on commit 7dd947a

Please sign in to comment.