LED configuration on fault


I've been running OpenWRT (OpenWrt 19.07.3 r11063-85e04e9f46) on my Plusnet router for about a week now and absolutely loving it.

One tweak I'd like to make is to the LED configuration. I've had a look through the documentation and think I understand it but can't find a suitable trigger.

Is there a way to configure each of the LED status lights on the front of the router to only illuminate if there is a problem....i.e. default-off but if the ADSL link drops then switch on to red?


1 Like

A similar thread: Change LED Lights Depending If WAN Connection Is Receiving Data

1 Like

Thanks for the pointers @lleachii they helped a great deal. For future reference here's how it's done...

The scripts below presume that you're using a BT Homehub v5a. If not, you'll need to look at what the LEDs are called in your config. Either take a look in '/sys/class/leds/' over SSH or look at the 'System->LED configuration' page through your routers LUCI web interface. And then update the script below.

SSH onto your box.

Create the following file in the /usr/bin/ folder by running this command:
vi /usr/bin/dslLED

In vi (I won't go into how to use it here) you need to paste the following:

#LED controls based on Internet connectivity

while :
                Status=$(ping -q -c 1 -W 1  > /dev/null 2>&1 && echo "ok" || echo "FAIL")
                if [ "$Status" != "ok" ]; then

                        echo 255 > /sys/class/leds/bthomehubv5a:red:broadband/brightness
                        echo 0 > /sys/class/leds/bthomehubv5a:red:broadband/brightness

                sleep 10

Set the permissions for the script to allow it to be executed:
chmod +x /usr/bin/dslLED

Now use vi again to create an init.d service entry so that your script is run every X seconds:
vi /etc/init.d/dslLED

Paste in this code:

#!/bin/sh /etc/rc.common


	/usr/bin/dslLED &

	ps | grep "dslLED" | grep -v grep | awk '{ print $1 }' | xargs kill -9

Set the permissions for the script to allow it to be executed:
chmod +x /etc/init.d/dslLED

Before you enable the script permanently you can test it by running:

/etc/init.d/dslLED start

and to stop it

/etc/init.d/dslLED stop

If everything works, enable it permanently by running:

/etc/init.d/dslLED enable


1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.