Skip to content

feat: add rate limit tracking and public API#148

Open
banter240 wants to merge 3 commits intoerwindouna:mainfrom
banter240:fix/request-improvements
Open

feat: add rate limit tracking and public API#148
banter240 wants to merge 3 commits intoerwindouna:mainfrom
banter240:fix/request-improvements

Conversation

@banter240
Copy link
Copy Markdown

Essential improvements for production use:

Rate Limit Support (NEW):

  • Add: Store response headers from API calls
  • Add: Parse RateLimit headers per IETF draft spec
  • Add: rate_limit property returning (limit, remaining) tuple
  • Add: last_headers property for debugging
  • Change: Use context manager to access headers before consuming body

Public API (NEW - enables extensions):

  • Add: session property (get aiohttp ClientSession)
  • Add: home_id property (get home ID)
  • Add: access_token property (get OAuth token)
  • Add: refresh_auth() public method (refresh token)

Model Fixes:

  • Fix: ZoneState null nextTimeBlock handling (API sometimes returns null)

Breaking Changes: None (only additions and one critical bug fix)

All changes are backward compatible. Existing code works unchanged.

Enables Home Assistant integrations to:

  • Track API quota usage (rate_limit property)
  • Build extensions without private attribute access (public API)
  • Handle edge cases in API responses (ZoneState fix)

@erwindouna erwindouna added the enhancement Enhancement of the code, not introducing new features label Feb 23, 2026
Copy link
Copy Markdown
Owner

@erwindouna erwindouna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing, here an initial review. :)

@banter240 banter240 force-pushed the fix/request-improvements branch 2 times, most recently from b46987b to 2b4e258 Compare February 23, 2026 17:36
Copy link
Copy Markdown
Owner

@erwindouna erwindouna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making solid progress. tadoasync is heavily tested. Would you mind including/updating tests, that way we can ensure we're releasing a solid package. :)

@erwindouna
Copy link
Copy Markdown
Owner

So I think, the only thing left are updating the tests. :)

@wmalgadey
Copy link
Copy Markdown
Collaborator

@erwindouna and @banter240 besides the tests, doesn't it make sense to add some kind of example or documentation because why exactly this is usefull or how it can be used?

@erwindouna
Copy link
Copy Markdown
Owner

@erwindouna and @banter240 besides the tests, doesn't it make sense to add some kind of example or documentation because why exactly this is usefull or how it can be used?

It sure does! :)

@github-actions
Copy link
Copy Markdown

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale label Mar 28, 2026
@erwindouna
Copy link
Copy Markdown
Owner

Some unresolved conflicts, @banter240. Can you check? :)

@github-actions github-actions bot removed the stale label Mar 29, 2026
banter240 and others added 3 commits March 30, 2026 08:22
Essential improvements for production use.

Rate Limit Support:
- Store response headers from API calls
- Parse RateLimit headers per IETF draft spec
- rate_limit property returning (limit, remaining) tuple
- last_headers property for debugging

Public API (enables extensions):
- session property (get aiohttp ClientSession)
- home_id property (get home ID)
- access_token property (get OAuth token)
- refresh_auth() public method (refresh token)

Model Fixes:
- ZoneState null nextTimeBlock handling (API sometimes returns null)

Breaking Changes: None (only additions and bug fixes)
All changes are backward compatible.
Co-authored-by: Erwin Douna <e.douna@gmail.com>
@banter240 banter240 force-pushed the fix/request-improvements branch from 87132f5 to 9f7c9f4 Compare March 30, 2026 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancement of the code, not introducing new features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants