home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.25k stars 29.86k forks source link

Asus WRT total transferred data amount resets when reach 4GB #31404

Open daha76 opened 4 years ago

daha76 commented 4 years ago

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

probot-home-assistant[bot] commented 4 years ago

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!

ZetaPhoenix commented 4 years ago

More information and history in #18643 that got closed due to inactivity.

daha76 commented 4 years ago

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.

kennedyshead commented 4 years ago

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

daha76 commented 4 years ago

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

wtzb commented 4 years ago

image

Also able to reproduce this issue.

robertormpc commented 4 years ago

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,

mwunderling commented 4 years ago

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.

brunokelo commented 4 years ago

I have the same problem.

CoreyVidal commented 4 years ago

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

18643 and #19002

Any ideas?

automaton82 commented 4 years ago

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.

github-actions[bot] commented 3 years ago

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.

daha76 commented 3 years ago

It looks like nobody willing to fix this...

ildar170975 commented 3 years ago

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

BaQs commented 3 years ago

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.

ildar170975 commented 3 years ago

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

github-actions[bot] commented 3 years ago

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.

CoreyVidal commented 3 years ago

This should not be closed.

probot-home-assistant[bot] commented 3 years ago

asuswrt documentation asuswrt source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

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)

mattmoo commented 2 years ago

Would be good to see a solution.

mattmoo commented 2 years ago

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
ildar170975 commented 2 years ago

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

mattmoo commented 2 years ago

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.

github-actions[bot] commented 2 years ago

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.

ildar170975 commented 2 years ago

2021.12.8 - the issue is still present

befantasy commented 2 years ago

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

iprak commented 2 years ago

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

befantasy commented 2 years ago

@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

github-actions[bot] commented 2 years ago

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.

ildar170975 commented 2 years ago

2022.7.4 the problem still there

hiatsu0 commented 1 year ago

2022.11.3: this issue still persists.

Is @befantasy ’s statistics method above still the only readonable workaround there is?

issue-triage-workflows[bot] commented 1 year ago

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.

ildar170975 commented 1 year ago

up

iprak commented 1 year ago

Yes still an issue.

mattmoo commented 1 year ago

I think we can consider this abandonware, move to https://github.com/Vaskivskyi/ha-asusrouter

ollo69 commented 1 year ago

I think we can consider this abandonware, move to https://github.com/Vaskivskyi/ha-asusrouter

Nothing to do with this issue that will not be fixed by a different integration version.

issue-triage-workflows[bot] commented 1 year ago

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.

ildar170975 commented 1 year ago

up

issue-triage-workflows[bot] commented 1 year ago

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.

ildar170975 commented 1 year ago

up

kennedyshead commented 1 year ago

Imo. the stastics integration is the way to go here, its either that or saving the value somewhere and appending to it but that seems to me as the same solution as statistics integration with the difference that its supported and a native solution to homeassistant. maybe the new http version will handle this once merged

issue-triage-workflows[bot] commented 10 months ago

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.

ildar170975 commented 9 months ago

up

issue-triage-workflows[bot] commented 6 months ago

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.

ildar170975 commented 6 months ago

Still there 2024.2.3

изображение

iprak commented 6 months ago

up

kaijk commented 5 months ago

Until/if this issue is resolved, consider passing the data into a template sensor with a state_class: total_increasing. That sensor should not reset to zero even if the source sensor does so. Best also to convert to MB or GB units in the template sensor. (Note: I'm not sure what the units are from the native sensor so you may need to adjust the divisor).


platform: template:
  sensors:
    - unique_id: asuswrt_cumulative_upload
      name:      ASUSWRT Cumulative Upload
      state_class: total_increasing
      unit_of_measurement: "MBits"
      state: >-
        {{ 
              sensor.<your router>_upoad | int(0) / 1024
        }}
issue-triage-workflows[bot] commented 2 months ago

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.

ildar170975 commented 2 months ago

up