PhilipsHue / PhilipsHueSDK-Java-MultiPlatform-Android

The Software Development Kit for Philips Hue Java Mulfi-Platform and Android (beta)
273 stars 214 forks source link

Regular `JSONException` on PHHueSDK.connect #36

Open lesteenman opened 7 years ago

lesteenman commented 7 years ago

Regularly, when calling connect on an instance of PHHueSDK, or when pushlinking (specifically, in the response I get after pushing the link button), I'm getting a JSONException from the PH internals:

04-24 00:05:52.162 28977-29009/me.steenman.wearhue W/System.err: org.json.hue.JSONException: Expected a ',' or '}' at 21495 [character 1 line 2]
04-24 00:05:52.162 28977-29009/me.steenman.wearhue W/System.err:     at org.json.hue.JSONTokener.syntaxError(JSONTokener.java:433)
04-24 00:05:52.162 28977-29009/me.steenman.wearhue W/System.err:     at org.json.hue.JSONObject.<init>(JSONObject.java:233)
04-24 00:05:52.162 28977-29009/me.steenman.wearhue W/System.err:     at org.json.hue.JSONObject.<init>(JSONObject.java:325)
04-24 00:05:52.162 28977-29009/me.steenman.wearhue  W/System.err:     at com.philips.lighting.hue.sdk.connection.impl.PHBridgeInternal.processResponse(PHBridgeInternal.java:438)
04-24 00:05:52.162 28977-29009/me.steenman.wearhue W/System.err:     at com.philips.lighting.hue.sdk.connection.impl.PHBridgeInternal$1.run(PHBridgeInternal.java:119)

This is the error that is thrown when connecting to a known bridge, specifically. It's always at the same character, and it seems to be just a single '}' from the end of the response. It seems to happen about once every three launches, and I have not seen it when simply updating a light's state, so far.

I'm developing for Android Wear 2.0, PHHueSDK 1.11.2, the newest huesdkresources.jar (as far as I know), and a bridge v2 running the April 12 patch.

How I'm connecting:

PHHueSDK hueSDK = PHHueSDK.create();
hueSDK.setAppName("WearHue");
hueSDK.setDeviceName(android.os.Build.MODEL);
hueSDK.getNotificationManager().registerSDKListener(this);

PHAccessPoint ap = new PHAccessPoint();
ap.setIpAddress(bridgeIp);
ap.setUsername(bridgeUser);

hueSDK.connect(ap);