Optimize LEDs on Freifunk routers

This is about the default configuration of the LEDs on router devices with the Freifunk / Gluon firmware (https://www.freifunk.net). For example, on my “TP-Link TL-WR841N/ND v9” the WAN and wifi LEDs are constantly blinking as there is constant traffic on the according devices. As this is by design in the Freifunk network, I’m not interested in the blinking. It is just distracting.

After I noticed that it is very simple to control those LEDs with the Gluon firmware (actually this is thanks to the OpenWRT base), it was just a little fun to write a script to let the LEDs show information I want to see:

  • LAN port LEDs are off
  • WAN LED shows whether fastd is running by checking if there is a Freifunk gateway assigned, this is very basic check indicator whether all is working fine
  • QSS LED shows the health of the system (memory, disk space, CPU load)
  • Wifi LED shows whether any clients are connected

To lower distracting, the WAN and QSS LEDs are off by default and are only set to blinking mode if there is something wrong. The wifi LED glows constantly as long as there is at least client connected to the Freifunk network.

The health checks for the QSS LED consist of:

  • CPU load below 0.8
  • At least three MB of memory available
  • NVRAM usage is not above 85%

Once any of this checks fails, the LED is set to blinking.

After all, this results in a device with no blinking LEDs if everything is fine and ideally two LEDs constantly glowing (Power and wifi).

The script can be found on github.com/eht16/freifunk-scripts/

To disable all controllable LEDs by default, use the following commands (need to be done only once):

uci set system.led_lan1.trigger='none'
uci set system.led_lan1.default=0
uci set system.led_lan2.trigger='none'
uci set system.led_lan2.default=0
uci set system.led_lan3.trigger='none'
uci set system.led_lan3.default=0
uci set system.led_lan4.trigger='none'
uci set system.led_lan4.default=0
uci set system.led_wlan.trigger='none'
uci set system.led_wlan.default=0

Finally, add a cronjob to run it periodically:

1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53,55,57,59 * * * * /bin/sh /etc/set_led_status.sh

Put this line in /usr/lib/micron.d/set_led_status (this is the only supported location for cronjobs on Gluon and micrond does not support */2).

Disclaimer: tested only on TP-Link TL-WR841N/ND v9 but should also work on similar devices.

Happy (no longer) blinking!