Nice.
Extending the script for setting tx-power and watching the remote-rx with an option to set the power without reconnect we will have a simple atpc.
Is there a way to set tx-power without loosing the connection?
Unfortunately, no. Any changes to tx-power (from either end) cause the wireless interface to stop and restart, resulting in a reconnect by the clients. Luckily, the reconnect only takes a split second.
For those considering trying the same thing, I have been using wanned’s script since early May and my system has been running great.
Uptime is better than 99% on any given day.
Likewise, I could not make this script work (using ROS 5.22).
I spent a long time with this script, trying to get it to work.
Finally I found line 22 contained an error, OR old code / syntax that now no longer works.
:set avgdbm ($avgdbm+[:pick [/int wir reg get [find interface=$wlanname] signal-strength] 0 ([:find [/int wir reg get [find interface=$wlanname] signal-strength] @]-3)])
The “@” symbol does not seem to belong (there’s no reference to it in the scripting manual) - what is it’s purpose?
Also, the “-3” at the end of the line does not make sense.
With the following changes to this line, it works really well:
:set avgdbm ($avgdbm+[:pick [/int wir reg get [find interface=$wlanname] signal-strength] 0 ([:find [/int wir reg get [find interface=$wlanname] signal-strength]]3)])
There is absolutely nothing wrong with that line, at least up through version 5.14. If you understood the scripting :pick and :find commands, you would realize that should not be removed.
The :pick command is taking a sub string from the signal strength result which looks like “-61dBm@54Mbps”
0 is the beginning of the string
The pick command will take the number of characters from that string equal to the numerical location of the “@” symbol minus 3 characters, resulting in a value of just -61 in our example.
I just copied and pasted the following into a cmdlin on version 5.14 and saw the expected result:
:put [:pick [/int wir reg get [find interface=wlan1] signal-strength] 0 ([:find [/int wir reg get [find interface=wlan1] signal-strength] @] -3)]
What “works really well” now is not what was intended and will have very undesirable results.
Your modifications actually break the :find command and result in a static :pick from 0 to 3. That appears to work correctly, unless you get a signal-strength below -99, in which case your modification will falsely report only the first two digits (i.e. -10 instead of -101). In cases of weak signal sensing, this is critical not to misread those values. If you have forced clients into a signal strength range that absolutely rules out the possibility of -100 or worse signals, then feel free to shorten that line further as follows:
:set avgdbm ($avgdbm+[:pick [/int wir reg get [find interface=$wlanname] signal-strength] 0 3)])