Discussions
RateLimits
So I wanted to ask if there could be a discussion around how to better setup rate limits for users other then a flat 10k number.
First let me explain the reason this is coming to mind which is a pretty simple cause. It seems rather obvious, but not all users are the same. Some users will be abusers and with 1 device flood the API with no concern of overall usage, while other will be studious. Often the most studious are those that also understand the impact and may have the most devices. I have over 30 devices myself that are actually active. That translates to over 30 when you consider I have a few devices that are bluetooth controllers, or simply multiple kits that are combined like a Y light kit that has 14 lights connected which is essentially 7 panel kits. So my setup is kind of large. I also have all of this integrated with Hubitat. Part of my integration tries to look at the devices integrated and then calculate a reasonable suggestion for users to use for polling to keep their devices updated and keeping a portion of calls reserved for activity, while not impacting rate limits. By default the integration sets everything up with a 300 second/ 5 min polling. Depending on the device and how it is used that should be more then sufficient most of the time. I also have allot of users that use LAN API options to further minimize their API activity.
That all being said I just noticed my suggested value for my home with 30 connected devices just hit 306 seconds or just over 5 min in my integration. That will only get worse. I have two devices that I am currently waiting for support in the New API and once that happens the number will continue to climb. 5 min between pooling isn't exactly horrible, but is a decent amount of time to wait for a Home automation to be updated.
In a way this is punishing users that have more devices. It would be nice if there was some way to scale the API Rate Limit based on number of devices. It would also help if technologies like MQTT could be used to reduce the polling needed by allowing polling to be turned on/off until certain events occur like a Device Power on or off.