Script for Automatically setting WIFI AP power

Anyways, a bit of background: I have a bunch of access routers on comm heavy mountain tops. The mountain top routers have a wifi AP setup. This makes it easy technicians to align dishes, check power sytems, etc. But I don't want to burn any of the 2.4Ghz band normally ... just when they are on site, which is almost never. But if they are on site I want the AP to light up with high tx power so they can stay connected when they are climbing on towers or back down at the truck. When they pack up and roll away, I wanted the AP to go low tx power. Fully automatic, no tech tweeking needed.

This is what I came up with. I used antenna-gain value since its easier to stay Eff-Si-Si legal with regulatory domain when tweeking the antenna-gain value.

Enjoy.

# Script to automatically reduce and increase AP power level (using antenna-gain)
# depending on number of clients registered to the AP.
# Run with: Enabled, Name="Wifi Power wlan1" StartTime=startup Interval=00:00:15 Policy=read,write

# Interface of the AP
:local iface "wlan1"
# Actual gain of the antenna, sets high power level when client is registered to AP
:local agmin 3
# Leave this at 24, sets low power level when nobody is registered to AP
:local agmax 24
# Min clients needed to go to high power. Typically set to 1
:local minreg 1

# Get number of registered clients and antenna gain of the AP
:local reg [/interface wireless registration-table find interface=$iface]
:local nmin [/interface wireless find antenna-gain=$agmin and name=$iface]
:local nmax [/interface wireless find antenna-gain=$agmax and name=$iface]
# Set the antenna-gain of the AP to high or low power depending on clients registered.
:if (([:len $reg] < $minreg) && ([:len $nmax] = 0)) do={ /interface wireless set antenna-gain=$agmax $iface; :log info "set antenna-gain=$agmax $iface"}
:if (([:len $reg] >= $minreg) && ([:len $nmin] = 0)) do={ /interface wireless set antenna-gain=$agmin $iface; :log info "set antenna-gain=$agmin $iface"}
Title : Script for Automatically setting WIFI AP power
Description : Anyways, a bit of background: I have a bunch of access routers on comm heavy mountain tops. The mountain top routers have a wifi AP se...

0 Response to "Script for Automatically setting WIFI AP power"

Posting Komentar