Code: Select all
import os
import psutil
import threading
def percent():
threading.Timer(5.0, percent).start()
if psutil.sensors_battery().percent < 11:
os.system("echo heartbeat > /sys/bus/platform/drivers/leds-gpio/gpio_leds/leds/blue:heartbeat/trigger")
elif psutil.sensors_battery().percent > 10:
os.system("echo none > /sys/bus/platform/drivers/leds-gpio/gpio_leds/leds/blue:heartbeat/trigger")
percent()
I am using RRVL. I am not sure if this is the best way to handle it, but it seems to work. I couldn't figure out any other way to control the LEDs.
I thought I would share it in case anyone else wanted a low battery light.