@zzz
Thanks for your solution, it's doing most of the job for me, but neither of my joysticks seem to wake the device back up. A keyboard stroke does wake the device though.
They are cheapo $40 amazon joystick kits, registering as js0/js1. Pi 3b+.
I tried OP's script, but it appears to not stay off for more than a couple seconds.
Were you able to find a workaround perhaps?