core icon indicating copy to clipboard operation
core copied to clipboard

Asus WRT total transferred data amount resets when reach 4GB

Open daha76 opened this issue 5 years ago • 52 comments

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

daha76 avatar Feb 02 '20 11:02 daha76

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.

TheRogueZeta avatar Feb 03 '20 01:02 TheRogueZeta

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.

daha76 avatar Feb 03 '20 06:02 daha76

I care about this, Its just that I have not found the solution yet ;)

kennedyshead avatar Feb 03 '20 09:02 kennedyshead

Ok, THX ;-) Just a wrong assumption as the previous thread was closed because of inactivity. Sorry.

daha76 avatar Feb 03 '20 09:02 daha76

image

Also able to reproduce this issue.

wtzb avatar Apr 30 '20 16:04 wtzb

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,

robertormpc avatar May 13 '20 17:05 robertormpc

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.

mwunderling avatar May 14 '20 18:05 mwunderling

I have the same problem.

brunokelo avatar Jun 04 '20 14:06 brunokelo

I care about this. There's 2 threads I've been following for years now:

#18643 and #19002

Any ideas?

CoreyVidal avatar Jun 08 '20 20:06 CoreyVidal

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.

automaton82 avatar Aug 17 '20 14:08 automaton82

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.

github-actions[bot] avatar Jan 26 '21 02:01 github-actions[bot]

It looks like nobody willing to fix this...

daha76 avatar Jan 26 '21 07:01 daha76

ASUS AC66U, ASUS AC68U - same problem: изображение

ildar170975 avatar Feb 20 '21 20:02 ildar170975

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.

BaQs avatar Mar 05 '21 20:03 BaQs

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).

ildar170975 avatar Mar 05 '21 21:03 ildar170975

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.

github-actions[bot] avatar Jun 03 '21 22:06 github-actions[bot]

This should not be closed.

CoreyVidal avatar Jun 03 '21 22:06 CoreyVidal

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.

mattmoo avatar Sep 25 '21 03:09 mattmoo

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

mattmoo avatar Oct 06 '21 23:10 mattmoo

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

ildar170975 avatar Oct 08 '21 15:10 ildar170975

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.

mattmoo avatar Oct 08 '21 19:10 mattmoo

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.

github-actions[bot] avatar Jan 06 '22 20:01 github-actions[bot]

2021.12.8 - the issue is still present

ildar170975 avatar Jan 06 '22 20:01 ildar170975

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 avatar Jan 25 '22 14:01 befantasy

@befantasy I am unable to implement statistics sensors. Can you share your definitions?

iprak avatar Feb 05 '22 17:02 iprak

@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

Preview Hu9sRH.png

History HuCmfe.md.png

befantasy avatar Feb 05 '22 17:02 befantasy

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.

github-actions[bot] avatar Jul 15 '22 17:07 github-actions[bot]