Force Disconnect Wireless Stations with Low CCQ - MikroTik Script RouterOS

This script checks all registered stations and forces a disconnect for any station(s) which has a CCQ level less than that specified below (in this example it's set to 70% for TX and for RX).

The idea is that once they are forced to disconnect, the stations will attempt to reassociate with the best available AP, eliminating the 'sticky node' problem.

The only modifications you need to make is to change your minimum allowed CCQ level.

On your APs:

/system script 
add name="station-check" source="/interface \
wireless registration-table\r:foreach i in=[ /interface wireless registration-table find ap=no] \
do={\r   :if ([get \$i tx-ccq] < \"70\" && [get \$i rx-ccq] < \"70\") do={\r :log warning \
([get \$i radio-name] . \" was disconnected due to low CCQ - Tx: \" . [get \$i tx-ccq] . \"% / Rx: \" . \
[get \$i rx-ccq] . \"%\")\r /interface wireless registration-table remove \$i\r \
:delay 5s\r }\r}"
Important: Remember that non-MikroTik stations will not report back their received CCQ, so the TX-CCQ will always be 0%.

Once you have configured the script, set up a scheduler to run the script everytime you want it to check for low signals. In the example below, the script will run every day at 1 second after midnight!

On your APs:

/system scheduler 
add disabled=no interval=1d name="station-check-schedule" on-event="/system script run \
   station-check ;" start-time=00:00:01
Credit: wiki.mikrotik.com