mirror of
https://github.com/bwssytems/ha-bridge.git
synced 2025-12-16 18:24:36 +00:00
addded logging for url item json decoding, fixed harmony activity json
decoding
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.bwssystems.HABridge</groupId>
|
||||
<artifactId>ha-bridge</artifactId>
|
||||
<version>4beta3.3</version>
|
||||
<version>4beta3.4</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HA Bridge</name>
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.bwssystems.HABridge.plugins.hue.HueHome;
|
||||
import com.bwssystems.HABridge.util.JsonTransformer;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
|
||||
import static spark.Spark.get;
|
||||
import static spark.Spark.options;
|
||||
@@ -746,9 +747,17 @@ public class HueMulator {
|
||||
} else if(!url.startsWith("[{\"item\""))
|
||||
url = "[{\"item\":" + url + "}]";
|
||||
|
||||
log.debug("Decode Json for url items: " + url);
|
||||
CallItem[] callItems = null;
|
||||
callItems = aGsonHandler.fromJson(url, CallItem[].class);
|
||||
|
||||
try {
|
||||
callItems = aGsonHandler.fromJson(url, CallItem[].class);
|
||||
} catch(JsonSyntaxException e) {
|
||||
log.warn("Could not decode Json for url items: " + lightId + " for hue state change request: " + userId + " from "
|
||||
+ ipAddress + " body: " + body + " url items: " + url);
|
||||
return aGsonHandler.toJson(HueErrorResponse.createResponse("3", "/lights/" + lightId,
|
||||
"Could decode json in request", "/lights/" + lightId, null, null).getTheErrors(), HueError[].class);
|
||||
}
|
||||
|
||||
for (int i = 0; callItems != null && i < callItems.length; i++) {
|
||||
if(!filterByRequester(callItems[i].getFilterIPs(), ipAddress)) {
|
||||
log.debug("filter for requester address not present in list: " + callItems[i].getFilterIPs() + " with request ip of: " + ipAddress);
|
||||
|
||||
@@ -135,7 +135,7 @@ public class HarmonyHome implements Home {
|
||||
} else {
|
||||
if(anItem.getType().trim().equalsIgnoreCase(DeviceMapTypes.HARMONY_ACTIVITY[DeviceMapTypes.typeIndex]))
|
||||
{
|
||||
RunActivity anActivity = aGsonHandler.fromJson(anItem.getItem().getAsString(), RunActivity.class);
|
||||
RunActivity anActivity = aGsonHandler.fromJson(anItem.getItem(), RunActivity.class);
|
||||
if(anActivity.getHub() == null || anActivity.getHub().isEmpty())
|
||||
anActivity.setHub(device.getTargetDevice());
|
||||
HarmonyHandler myHarmony = getHarmonyHandler(anActivity.getHub());
|
||||
|
||||
Reference in New Issue
Block a user