adafruit / Adafruit_CircuitPython_AdafruitIO

Adafruit IO for CircuitPython
http://io.adafruit.com
MIT License
49 stars 33 forks source link

Return User Usage Limits / Current Usage towards Throttle Limits #126

Open tyeth opened 1 month ago

tyeth commented 1 month ago

There is an API endpoint for fetching the current users data rate information. See the IO HTTP API Docs here: https://io.adafruit.com/api/docs/#get-detailed-user-info

The endpoint is https://io.adafruit.com/api/v2/tyeth/throttle where tyeth is your username. The result looks like this:

{
    "data_rate_limit": 90,
    "active_data_rate": 2,
    "authentication_rate": 0,
    "subscribe_authorization_rate": 0,
    "publish_authorization_rate": 0,
    "hourly_ban_rate": 0,
    "mqtt_ban_error_message": null,
    "sms_message_limit": 0
}

It would be useful to have this available to users via a method built into the IO_HTTP class. Ideally the MQTT class would also support this functionality, but it is currently not available over the MQTT broker (AFAIK).

tyeth commented 1 month ago

Tagging @CedarGroveStudios as they mentioned wanting such a feature in their adafruit-playground note about the Weather APIs: https://adafruit-playground.com/u/CGrover/pages/aio-weather-a-premium-alternative-for-local-observations#wish-list-3175903

CedarGroveStudios commented 1 month ago

Tagging @CedarGroveStudios as they mentioned wanting such a feature in their adafruit-playground note about the Weather APIs: https://adafruit-playground.com/u/CGrover/pages/aio-weather-a-premium-alternative-for-local-observations#wish-list-3175903

Thank you! Indeed it would be useful if a device could autonomously monitor shared feed rate status. That would make it much easier to support multiple independent project devices that need to use the same AIO feeds.