Repository navigation
Replies: 6 comments
|
I run Live Tennis API, the provider proposed in #371. Separating the non-secret overrides from credentials makes sense to me. A few constraints from our side may help define the shared interface:
A small shared credential resolver plus provider-owned budget/capability settings seems enough to discuss first, without adding a flow branch for every paid tier. I cannot finish aligning #371 until that shared approach is settled. I am marking it draft; please hold detailed code review until the design and the request-budget correction are in place. Live-key and real Home Assistant testing also remain unverified, as stated in the PR. |
|
I think both ideas fit together well. I would keep default.json only for non-secret provider settings/capabilities and keep user API keys completely separate. Any user-specific key, even a free one, should be treated as a secret. Public keys intentionally provided for everyone can stay provider-side. The bigger thing for me is rate limiting: the budget should belong to the credential, not to each sensor. If several teams/leagues use the same key, they should share caching, request limits and 429 backoff. So my preference would be:
That seems flexible enough for future providers without making the UI or regression testing much more complicated. |
|
Finally back after life and the ESPN API changes. It seems like there are three changes:
If I am missing anything, let me know. The current provider call stack to refresh team data is as follows, using espn as the example: Not all of the providers keep the separation this clean and well defined as they were developed over time, but I think this will serve us well going forward. This allows us to do the following:
This approach would allow us to share API responses across sensors based on how the cache key is defined, leverage the cache when available, and fall back to a stale cache if limits were hit.
For the credentials, my initial thought is to allow Let me know if this is clear, your general thoughts on this approach, and if I missed anything. |
|
Clear, and the three changes match what I need on my side. One correction to my own earlier comment first, because it changes the budget arithmetic. I said four tours would need four polls. They do not. One call to That makes the free plan workable. 100 requests a day is one poll every 15 minutes, with four spare. A faster in-play rate can be funded by slowing the idle rate, with no extra calls. For the call manager, three values you can read instead of model:
On credentials, The one thing I would add to your list is a freshness value the sensor can show while it is serving a stale cache. Our score object carries I will rework #371 against this once the breaking change lands. I can also run it against a live key and report what breaks. |
|
Here are my plans:
The response already returns the time of the last API call so I am not sure I understand the value of I hope to get the new release out this weekend or a little later. If this is missing something or contains something that won't work, lmk. The intent is to provide a base that you can build on. |
|
I meant data age inside the API, separate from your fetch time. I described age_seconds too broadly in my earlier comment. |
Uh oh!
There was an error while loading. Please reload this page.
The purpose of this discussion is to talk through design options for subcription API's.
Generally these API's offer a free tier w/ a public API key w/ a limited refresh rate and another paid tier w/ a private API key and a more frequent refresh rate. Potentially, they could offer additional data attributes w/ the paid tier.
My initial thought was to leverage the
overrides/default.jsonto hold the private keys. I expect it would work to override the refresh rate and potentially other variables that could be needed. I liked it because it was simple and contained. It could cleanly support keys at the provider, league, or team level. I'm not in love w/ private secrets indefault.json, but could probably solve this w/ an additionalsecrets.jsonfile. Not a big deal for most but it would ensure I other other contributors wouldn't accidently publish a private key.Another option would be to leverage the existing
secrets.yamlfile.Other options include adjusting the config and options flow and YAML config to accept the new configuration items. My concern is added complexity in the flow and the impact of unanticipated future additions. Config flow changes would be hard to take out and multiple variations get hard to regression test.
There may be other options that are worth considering.
My initial bias is to use
default.jsonfile for non-secret configurations andsecrets.jsonfor the private keys but look forward to the discussion and other ideas and perspectives. API providers will likely have a better sense of what variations should be considered or potentially arise in the future.All reactions