Fritzbox! Netmonitor limit reached 4gb

I successfully integrated my fritzbox and get a reading looking like this:

is_linked: true
is_connected: true
wan_access_type: Cable
external_ip: 1.1.1.1
uptime: 259675
bytes_sent: 940999160
bytes_received: 2496739625
transmission_rate_up: 12154
transmission_rate_down: 69178
max_byte_rate_up: 3312500
max_byte_rate_down: 26500000
friendly_name: fritz_netmonitor
icon: mdi:web

The values for bytes received and bytes send will reset after 4gb is reached, which looks like the max size u_int32 was reached

Anyone else with this problem?

HA 0.88.2 is used and the connected fritzbox is 6490 running os 7.0

Aeons ago I implememted a nagios (check_mk) monitor for fritzbox devices and had this issue as well.

Unfortunately this is an issue at the protocol level. The values are provided via TR-064 protocol by the router. And in the TR-064 interface all sent/received values are 4 byte unsigned int datatypes. Thus, they overflow at 4 GB as you already noticed. There’s not much either AVM or the user can do about it, because providing values bigger than 4 GB would be a violation of the TR-064 protocol plain and simple.

IIRC in my nagios check I eventually worked around this limitation by counting overflows in separate variables xyz and add xyz times 4 GB to the current value. But this was still unreliable as the check sometimes missed an overflow, especially if the full bandwidth of the WAN link was used and the check didn’t ran often enough.

And the values don’t necessarily match the values shown in the FritzBox UI. For this you would always have to reset your overflow counters at the same time the counters are reset in the FritzBox, f.e. when resetting the counters in the UI or restarting the router.

ok, but this is just odd, I would expect the component would just add up values instead of reseting those values to zero each time.

I will see if I can contribute some code to actually have a counter… but I have no idea how to write any python.