michielpost / Q42.HueApi

C# helper library to talk to the Philips Hue bridge
MIT License
409 stars 114 forks source link

Breaking bug: "Unexpected character encountered while parsing value: {. Path 'internetservices', line 40, position 23." #114

Closed niels9001 closed 7 years ago

niels9001 commented 7 years ago

Since API version 1.17 some new attributes have been added to the BridgeConfig. Looks like Q42.HueApi doesn't handle this yet and it breaks with the following error:

Unexpected character encountered while parsing value: {. Path 'internetservices', line 40, position 23. - -2146233088 at Newtonsoft.Json.JsonTextReader.ReadStringValue(Json.ReadType readType)

More info on the changes:

7.2.2 /config/starterkitid response is added. starterkitid string 1.18 Name of the starterkit created in the factory.

7.2.2 /config/internetservices response is added. remoteaccess String 1.17 Connected If remote CLIP is available. Disconnected If remoteaccess is unavailable, reasons can be portalservices are false or no remote connection is available.

Config documentation: https://developers.meethue.com/documentation/configuration-api

Changelog: https://developers.meethue.com/documentation/changelog

niels9001 commented 7 years ago

What would be the best solution for this? If we add these items and default them as null if they are not part of the JSON (basically for Bridges running API version 1.16 or earlier).

michielpost commented 7 years ago

Looks like a duplicate of https://github.com/Q42/Q42.HueApi/issues/112 Latest Q42.HueApi has these properties. Will be null on older bridge versions.

niels9001 commented 7 years ago

Oooh, completely missed that, and indeed, not checked for updates first. My bad, and thanks for the swift reply!