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?
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:
#!/bin/sh
#LED controls based on Internet connectivity
while :
do
Status=$(ping -q -c 1 -W 1 8.8.8.8 > /dev/null 2>&1 && echo "ok" || echo "FAIL")
if [ "$Status" != "ok" ]; then
echo 255 > /sys/class/leds/bthomehubv5a:red:broadband/brightness
else
echo 0 > /sys/class/leds/bthomehubv5a:red:broadband/brightness
fi
sleep 10
done
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