How to turn off the charging indicator on an android phone (ROOT)

I was using my phone at night with f.lux turned on, while I was charging the phone at the same time.

The charging indicator light was annoying my eyes, so I decided to find out how I can turn it off.

Turns out its quite simple to control the led light in android OS.

All you need to do to turn off the red light from the charging led indicator is this:

chmod 644 /sys/class/leds/red/brightness
echo 0 > /sys/class/leds/red/brightness
chmod 444 /sys/class/leds/red/brightness

And you should be good. now if you do these commands while charging your phone. The charging led should go off.

As an extra, you can turn off the green light too when the phone's battery is fully charged by doing the same, but changing the color to green:

chmod 644 /sys/class/leds/green/brightness
echo 0 > /sys/class/leds/green/brightness
chmod 444 /sys/class/leds/green/brightness

Automating this with tasker, makes it way easier than executing the commands manually every time you need them.