I have a Kodi/OpenElec front-end client that I use here in the home. And I just enable the WOL binding to wake it up, following the docs.
OH2 is running on Ubuntu, and I am able to Wake up the device fine. But I’m uncertain what the commands/syntax should like to put the Kodi/OpenElec machine back in a sleep/suspend mode. There is no Username/Password needed I think? And some searching seems to say the command should be pm-suspend?
as my system will be powered off by mythtv when kodi is not running this works like a charm for me.
in your case you may probably need to use System.OnSleep method.
Thanks. I gave that a try, but ended up with an HTTP error in the log. What are your running Kodi on? I wonder if running it on OpenElec requires something extra?
2017-02-19 14:23:25.811 [INFO ] [.eclipse.smarthome.model.script.FILE] - Kodi powered off
2017-02-19 14:23:25.815 [ERROR] [.smarthome.model.script.actions.HTTP] - Fatal transport error: java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
I think I may have an error in the rule. The log complains this is either empty or parsed incorrectly, yet the Designer shows nothing wrong with it.
rule "Kodi Basement Power Change"
when
Item OpenElecPC received command
then
if (OpenElecPC.state==OFF) {
logInfo( "FILE", "Kodi powered off")
sendHttpPostRequest("http://192.168.11.51:8088/jsonrpc", "application/json", '{"jsonrpc":"2.0","method":"System.Suspend","params":{}},"id":1}')
}
end