LED configuration Tp link Archer a7v5

Hi. Help with setting up the LED. It is necessary that the orange LED lights up when there is no Internet connection. Connection wan port - pppoe.The green one is set like this -
config led
option sysfs 'tp-link:green:wan'
option default '0'
option trigger 'switch0'
option port_mask '0x02'
option name 'WAN"

Based on some older threads, you could use a script like this:

cat << "EOF" > /root/wanled.scr
#!/bin/sh

while true; 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 0 > /sys/class/leds/tp-link:orange:wan/brightness
    echo 255 > /sys/class/leds/tp-link:green:wan/brightness

	else 

    echo 255 > /sys/class/leds/tp-link:orange:wan/brightness
    echo 0 > /sys/class/leds/tp-link:green:wan/brightness

	fi
	
	sleep 10

done
EOF
chmod 755 /root/wanled.scr

Insert /root/wanled.scr & in /etc/rc.local

did not work.The power LEDs began to flash and wi fi.and the lan LEDs went out

This script has nothing to do with the LEDs, other than the wan LED.

Post the output of

ll /sys/class/leds/ | grep wan

lrwxrwxrwx 1 root root 0 May 9 17:15 tp-link:green:wan -> ../../devices/platform/leds/leds/tp-link:green:wan/
lrwxrwxrwx 1 root root 0 May 9 17:15 tp-link:orange:wan -> ../../devices/platform/leds/leds/tp-link:orange:wan/

Looks OK.

Copy and paste the following:

echo 255 > /sys/class/leds/tp-link:orange:wan/brightness
echo 0 > /sys/class/leds/tp-link:green:wan/brightness

The wan LED should turn orange.

1 Like

output with flashing LEDs
lrwxrwxrwx 1 root root 0 Jan 1 1970 tp-link:green:wan -> ../../devices/platform/leds/leds/tp-link:green:wan/
lrwxrwxrwx 1 root root 0 Jan 1 1970 tp-link:orange:wan -> ../../devices/platform/leds/leds/tp-link:orange:wan/

So orange turned on, but only after deleting the script wanled

This is because the script checks the Internet connection every 10 seconds, and if it's OK, the wan LED turns green.
I made some tests with my Archer A7v5 and it works just fine without any side effects. If it doesn't work for you, just delete it.

1 Like

Thanks, deleted.

rc.local should be like this -

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
#!/bin/sh

while true; 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 0 > /sys/class/leds/tp-link:orange:wan/brightness
    echo 255 > /sys/class/leds/tp-link:green:wan/brightness

else 

    echo 255 > /sys/class/leds/tp-link:orange:wan/brightness
    echo 0 > /sys/class/leds/tp-link:green:wan/brightness

fi

sleep 10

done



exit 0
2 Likes

This is awesome! I had no idea we could control leds this way! I'm gonna implement my monitor to as a webservice and use a script to call it and blink some leds too