FritzBox TR064 Binding: Online Monitor

Hi all,
i try to rebuild the online monitor from the FritzBox to check my Up-/Downstream with openHAB.

First I tried to use the values “fboxDslUpstreamCurrRate” and “fboxDslDownstreamCurrRate” till I found out, that they are only the given numbers of the provider.

My next Idea is to use the “fboxWanTotalBytesReceived” Value to calculate my downstream within a rule, but my values look not correct,…

Here is what I tried to get the current Downstream in kBit/s:

downloadCurrent = fboxWanTotalBytesReceived.deltaSince(now.minusSeconds(1)) / 1000

But the values looks much higher then what I can see in the FritzBox Monitor :frowning: .

Did someone of you something like that?
Or has an Idea?

Would be very happy to get this done!
Kind regards,

Currently I’m working on exactly the same goal, but I’m not there yet…
But what I can tell you right now: the unit of your variable downloadCurrent would be kByte per second, but you compare it to kBit/s. Thus to get kBit/s the line should be:
downloadCurrent = fboxWanTotalBytesReceived.deltaSince(now.minusSeconds(1)) * 8 / 1000
Problem is: this number would be even higher and you say, your current value already is higher on your FritzBox.
Another idea: you compare the value fboxWanTotalBytesReceived with the value a second ago. The default refresh interval is 60000 ms per default. Have you changed it to 1000 ms? Or are you comparing your current value with a value 60 s ago? That would be an explanation for your high values.

For verification, I just used the values written in events.log,
2020-04-28 15:14:49.036 [vent.ItemStateChangedEvent] - fboxWanTotalBytesReceived changed from 5675675 to 150062945 2020-04-28 15:15:55.605 [vent.ItemStateChangedEvent] - fboxWanTotalBytesReceived changed from 150062945 to 293525632
With these numbers youl’ll get: `(293525632 - 150062945) * 8 Bit / (67 seconds * 1000) = 17130 kBit/s which is the same magnitude I see in my Online Monitor.

Btw, pay attention as this value is an Int32. Therefore it overflows at 4294967295 which you have to catch.