kbr / fritzconnection

Python-Tool to communicate with the AVM Fritz!Box by the TR-064 protocol and the AHA-HTTP-Interface
MIT License
304 stars 59 forks source link

Misleading link rates returned by fritzstatus; M vs Mi confusion #52

Closed wfjm closed 3 years ago

wfjm commented 4 years ago

On my system fritzstatus gives

    max. bit rate       : ('11.9 MBit/s', '59.3 MBit/s')

while my FrizBox GUI states

  Geschwindigkeit: ​down 62,2 Mbit/s up 12,4 Mbit/s

The culprit is that fritzstatus defines str_max_bit_rate as

  format_rate(upstream, unit='bits'),
  format_rate(downstream, unit ='bits')

and format_rate is defined as

   return format_num(num, unit=unit) + '/s'

and format_num converts in power of 1024 units.

Thus the classical MB vs MiB confusion, see Mebibyte.

The binary units are used for addressable items in binary systems. Memory size is in general measured in these units.

In all other cases decimal units are used. Bit rates, which are frequencies, are always expressed in decimal units, so 1 Mbps always means 1000*1000 bits/sec and not 1024*1024 bits/sec.

So usage of format_num in fritzconnection should imho be reviewed.

Mape6 commented 3 years ago

You are right @wfjm The format_num should calculate with 1000 not 1024. I hope that the author will change that.

kbr commented 3 years ago

Changed with 1.4.1