core
core copied to clipboard
Asus WRT total transferred data amount resets when reach 4GB
The problem
I have latest Hassio running in docker on RPi 3B+. I added AsusWRT integration but when I streaming/downloading the amount of transferred data can show maximum of 4GB and then it starts form 0. Looks like counter overflow.
Environment
arch | armv7l dev | false docker | true hassio | true os_name | Linux python_version | 3.7.6 timezone | Europe/Bratislava version | 0.104.3 virtualenv | false mode | storage resources | 0 views | 4
Problem-relevant configuration.yaml
asuswrt:
host: 192.168.1.1
username: admin
password: !secret asus_router
sensors:
- upload
- download
- upload_speed
- download_speed
Additional information
Link to the download sensor stats https://drive.google.com/open?id=10Nq5VoGWbOcAzAS7jLQm-ZlzfWGRuRQ9
Hey there @kennedyshead, mind taking a look at this issue as its been labeled with a integration (asuswrt) you are listed as a codeowner for? Thanks!
More information and history in #18643 that got closed due to inactivity.
Hmmm thanks for the info. As there is no solution, it looks like nobody cares. My router reports proper amount of transferred data and because there is a 4.3GB max value it looks like counter overflow. This overflow can be a risky or can cause memory leaks.
I care about this, Its just that I have not found the solution yet ;)
Ok, THX ;-) Just a wrong assumption as the previous thread was closed because of inactivity. Sorry.

Also able to reproduce this issue.
Im having the same issue, when the download and upload counter reaches 4.3gb it individually resets. I have Home assistant 109.6 and asuswrt to the latest version 3.0.0.4.385_20490 - router RT-AC88U.
I would love to have a proper meter for this.
Not sure if it helps, but at the post https://github.com/home-assistant/core/issues/18643#issuecomment-443043759 looks like @arigit found a workaround. Im not technically capable to perform it with such overview guidelines though. I holp there's a solution to this.
All the best,
Throwing my hat in the ring as I care about this as well. Having the same issue as the other commenters. This renders the upload/download sensor data meaningless. Would hugely appreciate any commentary whether a fix may be available "soonish" or if a viable workaround like using a template counter is possible.
I have the same problem.
I care about this. There's 2 threads I've been following for years now:
#18643 and #19002
Any ideas?
I also have this problem. It appears the library aioasuswrt the following to get the RX / TX amounts:
_RX_COMMAND = 'cat /sys/class/net/{}/statistics/rx_bytes'
_TX_COMMAND = 'cat /sys/class/net/{}/statistics/tx_bytes'
The problem is that file is not accurate, and there doesn't seem to be any other way to get an accurate value out of it.
So at this point I think there's no way to solve this unless HA starts maintaining historical data for this, which is probably not ideal.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
It looks like nobody willing to fix this...
ASUS AC66U, ASUS AC68U - same problem:

I suppose this issue is similart to what you could see in snmp: when the counter is "too high", it resets to zero. and does not increment itself.
It may depend on type of variable used to calculate traffic: if it is 32bit integer then the max value is 2^32=4294967296 which may be presented as ~4.3 (which is not actually right).
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
This should not be closed.
asuswrt documentation asuswrt source (message by IssueLinks)
Hey there @ollo69, mind taking a look at this issue as its been labeled with an integration (asuswrt) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)
Would be good to see a solution.
Maybe one day this will be fixed, until then I added some sensors using the integration platform that seem to work okay.
- platform: integration
source: sensor.asuswrt_upload_speed
name: asuswrt_upload_integral_total_mbit
unit_time: s
round: 0
method: left
- platform: template
sensors:
asuswrt_upload_integral_total_gb:
friendly_name: "Upload total"
value_template: "{{ (states('sensor.asuswrt_upload_integral_total_mbit')|float / 8192) | round(1) }}"
unit_of_measurement: GB
- platform: integration
source: sensor.asuswrt_download_speed
name: asuswrt_download_integral_total_mbit
unit_time: s
round: 0
method: left
- platform: template
sensors:
asuswrt_download_integral_total_gb:
friendly_name: "Download total"
value_template: "{{ (states('sensor.asuswrt_download_integral_total_mbit')|float / 8192) | round(1) }}"
unit_of_measurement: GB
unit: Mbit
There is no such an option is the docs: https://www.home-assistant.io/integrations/integration/
float / 8000
I think it is better to use 8192
unit: Mbit
There is no such an option is the docs: https://www.home-assistant.io/integrations/integration/
Yes it is unnecessary, although that value is probably only consumed by the template sensor.
float / 8000
I think it is better to use 8192
You're probably right, although the error from the integration might well be larger than that.
I'll edit it.
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.
2021.12.8 - the issue is still present
I thinks it's not a problem. It shoud be a “reset mechanisms” that prevent the value of counter goes too big. So, you should define a new sensor with a time window limatation by using "Statistics integration". For example: "Data transferred last hours", "Data transferred last day".
You can use the State Characteristic "change or total" to define a new number source sensor which record the increasement between the oldest and newest measurement stored.
[reference] https://www.home-assistant.io/integrations/statistics/ https://developers.home-assistant.io/docs/core/entity/sensor/#long-term-statistics
@befantasy I am unable to implement statistics sensors. Can you share your definitions?
@befantasy I am unable to implement statistics sensors. Can you share your definitions?
Finally, I chose utility meter integration + apexcharts-card frontend to solve this problem. It's more flexible.
home assistant configuration.yaml
utility_meter:
hourly_upload:
source: sensor.asuswrt_upload
name: Hourly upload
cycle: hourly
hourly_download:
source: sensor.asuswrt_download
name: Hourly download
cycle: hourly
apexcharts-card
type: custom:apexcharts-card
update_interval: 2m
stacked: false
graph_span: 13h
span:
end: hour
hours_12: false
header:
show: true
title: 网络流量
show_states: false
colorize_states: true
series:
- entity: sensor.hourly_upload
name: 上传
type: column
color: '#3397da'
opacity: 0.6
group_by:
func: max
duration: 1h
show:
legend_value: false
- entity: sensor.hourly_download
name: 下载
type: column
color: '#7b4a8d'
opacity: 0.6
group_by:
func: max
duration: 1h
show:
legend_value: false
apex_config:
chart:
height: 200px
There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

