There is a way you can echo a command to a system device to change the states of the LEDs, I was hoping for some detail listing of commands but this is the best I found.
According to that link, controlling LEDs is all about writing to specific files. So rather than running a shell command, you should write to the file in the usual way.
Code:
with open('/sys/class/leds/pandora::power/brightness', 'w') as led:
led.write('255')
I got the op_power.sh lid-event to work from a hotkey without password this way...
#!/bin/bash
# op_Standby.sh
# Assign this to a hotkey combo for instant SLEEP
# /usr/pandora/scripts/op_power.sh 0 <- Standby
# /usr/pandora/scripts/op_power.sh 3 <- Shutdown
# /usr/pandora/scripts/op_power.sh 0 lid <- for lid open event
# /usr/pandora/scripts/op_power.sh 1 lid <- for lid close event
sudo "/usr/pandora/scripts/op_power.sh" 0
#
# To make it a act as a standard command
# sudo cp ./bin/op_Standby.sh /usr/bin/op_standby
# PowerSettings require a password, therefore
# Edit the Suduers list in nano or you'll break the file
#
# sudo nano \etc\sudoers.d\50_openpandora
# "Add the following to the top of the file"
# %wheel ALL=(ALL) NOPASSWD: /usr/pandora/scripts/op_power.sh
I would like something similarly workable for the LEDs.
I tried a few related methods which did not work as we are writing to a file not running an executable.