Fix deprecated async_get_bytes_total in asuswrt#170986
Conversation
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>
There was a problem hiding this comment.
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!
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
|
Hey there @kennedyshead, @ollo69, @Vaskivskyi, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
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 separateasync_get_rx()andasync_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() |
Proposed change
aioasuswrt1.5.4 deprecatedasync_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_byteswith direct calls toasync_get_rx()andasync_get_tx(), which are the underlying methods the old function previously called.Type of change
Additional information
aioasuswrt#154753Checklist
python3 -m script.hassfmt)