Closed gkapellmann closed 1 year ago
var handler = new HttpClientHandler()
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
};
hueHttpClient = new HttpClient(handler);
hueHttpClient.Timeout = Timeout.InfiniteTimeSpan;
localHueApi = new LocalHueApi("IP", "KEY", hueHttpClient);
The answer from @HolgerFreudenreich could help, to set an infinite timeout. But the bridge should send back an answer, so it shouldn't be needed.
Is the IP address correct?
Can you do other calls, like:
var result = await localHueClient.GetBridgesAsync();
Does that give back a result? If it doesn't, there is something wrong with your ip/key or connection to the bridge.
Thanks for the answer @HolgerFreudenreich
@michielpost The IP is correct, I can actually receive all the events when changing lights, and retrieve the status of the ligths.
The problem appears if I dont do a call of any kind and just leave the program Idle, then after the 100 seconds, it gets fired.
I was able to reproduce this and just pushed a fix.
The StartEventStream
method is modified to use it's own HttpClient
with an Infinite Timeout. You can optionally pass your own HttpClient
if you want to override this behaviour.
Fix is pushed to NuGet in version 0.9.7
Awesome, will test tonight.
Works perfect now, thanks!
Hello,
I am getting this Exception:![image](https://user-images.githubusercontent.com/7535220/205939951-99a28d5a-edf9-4514-b3a8-2cca43ec7460.png)
Basically says: System.Threading.Tasks.TaskCanceledException: 'The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.'
I get tit becuase fo this line: localHueClient.StartEventStream();
If I comment this line, it just doesnt happen. Am I configuring something wrong?