ebaauw / homebridge-hue

Homebridge plugin for Philips Hue
Apache License 2.0
894 stars 91 forks source link

Status `429` after a call of `/eventstream/clip/v2` #1139

Closed swsoyee closed 1 year ago

swsoyee commented 1 year ago

Issue

I found in the log that after a call of GET /eventstream/clip/v2, it won't connect anymore. Unless the hue bridge is restarted. I'm using homebridge-hue v0.13.51 but I've been having this problem for a long time.

Log Messages

*The previous logs were working fine so I've omitted them here*
[1/23/2023, 12:18:31 AM] [Hue] Philips hue: event stream request 2: GET /eventstream/clip/v2
[1/23/2023, 12:18:31 AM] [Hue] Philips hue: event stream request 2: read ECONNRESET
[1/23/2023, 12:18:31 AM] [Hue] Philips hue: event stream connection to https://192.168.68.51/eventstream/clip/v2 closed - retrying in 15s
[1/23/2023, 12:18:46 AM] [Hue] Philips hue: event stream connected to https://192.168.68.51/eventstream/clip/v2
[1/23/2023, 12:18:47 AM] [Hue] Philips hue: request 3028: GET /sensors
[1/23/2023, 12:18:47 AM] [Hue] Philips hue: request 3028: http status 429 Too Many Requests
[1/23/2023, 12:18:52 AM] [Hue] Philips hue: request 3029: GET /sensors
[1/23/2023, 12:18:52 AM] [Hue] Philips hue: request 3029: http status 429 Too Many Requests
[1/23/2023, 12:18:57 AM] [Hue] Philips hue: request 3030: GET /sensors
[1/23/2023, 12:18:57 AM] [Hue] Philips hue: request 3030: http status 429 Too Many Requests
[1/23/2023, 12:19:02 AM] [Hue] Philips hue: request 3031: GET /sensors
[1/23/2023, 12:19:02 AM] [Hue] Philips hue: request 3031: http status 429 Too Many Requests
[1/23/2023, 12:19:07 AM] [Hue] Philips hue: request 3032: GET /sensors
[1/23/2023, 12:19:07 AM] [Hue] Philips hue: request 3032: http status 429 Too Many Requests
[1/23/2023, 12:19:12 AM] [Hue] Philips hue: request 3033: GET /sensors
[1/23/2023, 12:19:12 AM] [Hue] Philips hue: request 3033: http status 429 Too Many Requests

Debug Files

ebaauw commented 1 year ago

The log shows a connection reset (by the Hue bridge) on the first attempt to connect to the event stream (on 12:18:31), but on retry 15s later the connection succeeds.

The GET /sensors is Homebridge Hue polling the Hue bridge - nothing to do with the event stream. I haven't seen this status being returned by the Hue bridge before; it would seem the bridge has choked. Power-cycling it seems the way forward.

Did the issue start after upgrading the Hue bridge to a particular firmware version? How many other clients do you have connected to the Hue bridge? Do you have a firewall or reverse proxy in between Homebridge Hue and the Hue bridge?

swsoyee commented 1 year ago

Did the issue start after upgrading the Hue bridge to a particular firmware version?

Maybe yes. I forgot from which version, feels like it was near July last year(https://developers.meethue.com/rate-limiting-status-code/). Now my hue bridge version is 1.55.1955082050

How many other clients do you have connected to the Hue bridge?

11 lights, 4 sensor, 4 switch and 1 botton. In the meantime I have been using Node-red to get the device status, and accessing the sensor status directly via the API at intervals of several minutes (using curl command).

Do you have a firewall or reverse proxy in between Homebridge Hue and the Hue bridge?

No. This usually happens after a few hours of normal operation, after that these logs show in the log panel, and I need to unplugging the Bridge to reboot it. Sometimes the same problem occurs again within a very short time, sometimes it work fine lasts for hours or half a day.

ebaauw commented 1 year ago

Well, the Homebridge log doesn’t show ann excessive amount of requests in a short time. As I said before, I haven’t seen any reports about this before, so my best guess is that it’s due to your specific setup or bridge

Is the API key (username) used by Homebridge Hue shared by other API clients? If so, create a new key and use that exclusively for Homebridge Hue. You might increase the heartrate to poll the bridge less frequently, but I doubt that will make any difference. Not fun, but I would seriously consider factory resetting the Hue bridge.

swsoyee commented 1 year ago

Thank you for your help, I will try out a the methods you have mentioned. I will let you know if there is any improvement.

swsoyee commented 1 year ago

After I tried all sorts of methods that didn't improve it, I chose factory resetting the Hue bridge and it worked. Thank you for your advice!