Skip to content

Fix deprecated async_get_bytes_total in asuswrt#170986

Draft
rextroumbley wants to merge 1 commit into
home-assistant:devfrom
rextroumbley:fix/asuswrt-async-get-bytes-total
Draft

Fix deprecated async_get_bytes_total in asuswrt#170986
rextroumbley wants to merge 1 commit into
home-assistant:devfrom
rextroumbley:fix/asuswrt-async-get-bytes-total

Conversation

@rextroumbley
Copy link
Copy Markdown

Proposed change

aioasuswrt 1.5.4 deprecated async_get_bytes_total() — it now logs a warning and returns (0, 0) instead of real data, causing byte sensors to always read zero and spamming the log on every poll.

Replace the single deprecated call in _get_bytes with direct calls to async_get_rx() and async_get_tx(), which are the underlying methods the old function previously called.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (python3 -m script.hassfmt)
  • Tests have been added to verify that the new code works.

aioasuswrt 1.5.4 deprecated async_get_bytes_total() with a warning
and stubbed it to return (0, 0). Replace the call in bridge.py with
the direct async_get_rx() and async_get_tx() methods.

Fixes home-assistant#154753

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 17, 2026 14:54
Copy link
Copy Markdown
Contributor

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

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

Hi @rextroumbley

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant Bot marked this pull request as draft May 17, 2026 14:54
@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @kennedyshead, @ollo69, @Vaskivskyi, mind taking a look at this pull request as it has been labeled with an integration (asuswrt) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of asuswrt can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign asuswrt Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the AsusWrt bridge’s byte sensor retrieval to fetch RX and TX values via separate API calls instead of a single “total bytes” call.

Changes:

  • Replace async_get_bytes_total() with separate async_get_rx() and async_get_tx() calls in _get_bytes.

async def _get_bytes(self) -> tuple[float | None, float | None]:
"""Fetch byte information from the router."""
return await self._api.async_get_bytes_total()
return await self._api.async_get_rx(), await self._api.async_get_tx()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[asuswrt] async_get_bytes_total is deprecated in aioasuswrt

2 participants