tomaae / homeassistant-mikrotik_router

Mikrotik router integration for Home Assistant
Apache License 2.0
282 stars 43 forks source link

[Bug] Traffic TX/RX Total incorrect #352

Closed KoalaBear84 closed 2 months ago

KoalaBear84 commented 4 months ago

Describe the issue

The values shown/detected in Home Assistant are ~7.5 times less than the values in Mikrotik.

How to reproduce the issue

  1. Add Mikrotik integration
  2. See values reported

Expected behavior

Correct values as seen in Mikrotik

Screenshots

Mikrotik: image

Home Assistant: image

It was rebooted ~ 12.5 hours ago, and it started counting again (which is good): image

Software versions

[admin@MikroTik] > /system/resource/print
                   uptime: 12h37m59s
                  version: 7.14.1 (stable)
               build-time: 2024-03-08 12:50:23
         factory-software: 6.46.3
              free-memory: 168.7MiB
             total-memory: 256.0MiB
                      cpu: MIPS 1004Kc V2.15
                cpu-count: 4
            cpu-frequency: 880MHz
                 cpu-load: 25%
           free-hdd-space: 2120.0KiB
          total-hdd-space: 16.0MiB
  write-sect-since-reboot: 78119
         write-sect-total: 19627118
        architecture-name: mmips
               board-name: hEX
                 platform: MikroTik
[admin@MikroTik] > /system/routerboard/print
       routerboard: yes
        board-name: hEX
             model: RB750Gr3
          revision: r4
     serial-number: ****
     firmware-type: mt7621L
  factory-firmware: 6.47.9
  current-firmware: 7.14
  upgrade-firmware: 7.14.1

Diagnostics data

Removed bridge_host, arp, kid-control, dhcp, host, and client_traffic.

All the values in here are like the values from the Mikrotik terminal and screenshots, so that luckily is correct.

config_entry-mikrotik_router-bff2ea65e24355c052f45769f1978e89-redacted.json

Traceback/Error logs

Additional context

github-actions[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

KoalaBear84 commented 3 months ago

Bump

tomaae commented 3 months ago

HA show average traffic since last pool, not realtime like mikrotik UI. Also, you are comparing bits with bytes. That would be that ~8 times difference ;) Btw, RouterOS 7.14.1 with v2.1.4 wont work, that would crash right away.

KoalaBear84 commented 3 months ago

OK, maybe the issue was not clear. It's clear that the value in HA can be seconds/minutes old, depending on the polling interval, that's fine.

But HA reports RX total 18.3 GB / TX total 4.6 GB while it should be RX total 136.6 GB / TX total 34.6 GB. Please check the included config file to see that the values are not OK.

Relevant parts:

{
  "data": {
    "data": {
      "interface": {
        "ether2": {
          "default-name": "ether2",
          "name": "ether2",
          "type": "ether",
          "rx-current": 149272510241,
          "tx-current": 38170446964,
          "rx-total": 149272510241,
          "tx-total": 38170446964
        },
        "glasnet": {
          "default-name": "glasnet",
          "name": "glasnet",
          "type": "pppoe-out",
          "rx-current": 54001823074,
          "tx-current": 148542453762,
          "rx-total": 54001823074,
          "tx-total": 148542453762
        }
      }
  }
}

149272510241 / 1024 / 1024 / 1024 = 139.0 GB 38170446964 / 1024 / 1024 / 1024 = 35.6 GB

Which is not anywhere close to 18.3 GB / 4.6 GB.

tomaae commented 3 months ago

Ah, you mean total. This was fixed in a61dfa5ff7e1e6d2b744e0cdfeee08377e277e2d

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

KoalaBear84 commented 2 months ago

Bump

tomaae commented 2 months ago

Like I said, this was already fixed. You can give master a test if you want.

KoalaBear84 commented 2 months ago

OK, sorry for misunderstanding this. Because I tought "master" as in the released branch, not development.

Tried downloading this verison with HACS, but that fails. Removed the whole integration from HA, and from HACS. Tried to (re)install it again, but that fails. I'm guessing this will never work (as it isn't a release)?

Logger: custom_components.hacs
Source: custom_components/hacs/repositories/base.py:986
integration: HACS (documentation, issues)
First occurred: 07:47:58 (1 occurrences)
Last logged: 07:47:58

<Integration tomaae/homeassistant-mikrotik_router> Failed to download https://github.com/tomaae/homeassistant-mikrotik_router/releases/download/master/mikrotik_router.zip

https://hacs.xyz/docs/faq/select_version/

How should it work? It's not specifically mentioned in: https://github.com/tomaae/homeassistant-mikrotik_router?tab=readme-ov-file#using-mikrotik-development-branch

tomaae commented 2 months ago

try now

KoalaBear84 commented 2 months ago

Thanks, it works. Would like to let you know that a checkbox has no title/label: image

tomaae commented 2 months ago

hmm, I probably need to check out translations to github. thats not on your side.