If I turn the light on with this program, it stays on when the device enters sleep mode. If I turn the light on through the button, it gets turned off for sleep mode
So it would seem that pressing the light button sets a flag somewhere, which is then being read by the sleep routine.
I was looking for a script somewhere that handles sleep mode, but couldn't find anything. Running strace on nickel also didn't give me recognizable hints.