Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON AggregateException when updating lights #319

Open
logicallysynced opened this issue Aug 17, 2024 · 1 comment
Open

JSON AggregateException when updating lights #319

logicallysynced opened this issue Aug 17, 2024 · 1 comment

Comments

@logicallysynced
Copy link

logicallysynced commented Aug 17, 2024

Hi there,

I seem to be getting this exception every few seconds when updating my lights (Hue Play). I'm just using the example code for now, and they do update correctly if I ignore the exception, but it would be good to find out the reason:

Color color = dataSet[0].color;
var rgbColorHue = new HueApi.ColorConverters.RGBColor(color.R, color.G, color.B);

// Create the light update command
var req = new UpdateLight()
    .TurnOn()
    .SetColor(rgbColorHue);
    
var result = _client.UpdateLightAsync(_light.Id, req).Result;

I'm fairly confident the error isn't coming from my codebase:

System.AggregateException
HResult=0x80131500
Message=One or more errors occurred. ('<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.)
Source=System.Private.CoreLib
StackTrace:
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.get_Result() at Devices.Hue.HueUpdateQueue.Update(ReadOnlySpan1 dataSet) in
This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
JsonException: '<' is an invalid start of a value. Path: $ | LineNumber: 0 | BytePositionInLine: 0.

Inner Exception 2:
JsonReaderException: '<' is an invalid start of a value. LineNumber: 0 | BytePositionInLine: 0.

@michielpost
Copy link
Owner

Unable to reproduce this. Can you check what data your bridge returns by using a tool like Telerik Fiddler? It might return something else than json.
Maybe you're sending too many requests and it's better to use the Entertainment API?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants