I just wanted to add the information, that the powerstate is in $1 as 1 (on) or 0 (off).
Don’t know, if any other parameters are given.
I looked for this little piece of information a long time before finding it.
Might be obvious to many people, but I would have loved to find it here, because this thread shows up on top for the -S parameter