OpenWrt Forum Archive

Topic: How does it work- Signal Strength in Luci

The content of this topic has been archived on 1 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I have a question like this: how is the signal strenght in GUI of OpenWRT measured?
I am looking for a reliable way to measure that value, so I am really interested in that topic.

Is it maybe possible to get that value that is displayed in GUI in a remote way, maybe even using some script?

Thank you for all your responses and I really invite everyone to the discussion because I would really appreciate some advices in that topic.

The formula is extremely simple and more or less copied verbatim from the obsoleted wireless-utils.
A mac82011 driver usually reports a signal as negative dB value, e.g. -87, the formula used to turn this into a "quality" is:

quality = max(min(signal, -40), -110) + 110

This gives you a range of 0 .. 70 for possible quality values, to turn that into a percentage (mostly used to draw fancy bars or reception strength indicators for UIs) the formula is:

 (100 / 70) * quality

You can obtain those values using the iwinfo program, the libiwinfo C library or the libiwinfo-lua binding.
Example program to print the quality value of "wlan0":

#!/usr/bin/lua

require "iwinfo"

local iface = "wlan0"
local backend = iwinfo.type(iface)

if not backend then
        error(iface .. " is not a supported wireless device")
end

local bssid, info
local assoc = iwinfo[backend].assoclist(iface)

for bssid, info in pairs(assoc) do
        print(string.format(
                "Quality of %s is %.2f%% (Signal: %d dBm)",
                bssid,
                (100 / 70) * (math.max(math.min(info.signal, -40), -110) + 110),
                info.signal
        ))
end

Note that this will dump all quality values for all stations in AP mode. The OpenWrt LuCI gui simply displays the average of all qualities in AP mode.

The discussion might have continued from here.