Hi,
i need some help with my little simple rule.
I want to power off my remote controll wall socket for the PC if the PC is powered off and no ping comes back.
Here is my rule:
import org.openhab.core.library.types.*
import org.openhab.model.script.actions.*
import java.lang.Math
import java.util.Calendar
import java.util.Date
import java.util.TimeZone
import java.text.SimpleDateFormat
import org.joda.time.*
import org.openhab.model.script.actions.Timer
rule "SteamLink aktiv und SteamMachine anschalten"
when
Item harmonyhub_hub_Wohnzimmer_currentActivity changed to SteamLink
then
sendCommand(r135c, ON)
end
rule "SteamMachine auschalten"
when
Item harmonyhub_hub_Wohnzimmer_currentActivity changed to PowerOff
then
sendCommand(Wake_SteamMachine, OFF)
postUpdate(Wake_SteamMachine, OFF)
if(Online_Desktop.state = "OFF") {
createTimer(now.plusSeconds(10)) [| sendCommand(r135c, OFF) ]
}
end
Here is my item for my PC:
Switch Online_Desktop "SteamMachine" {nh="172.16.17.50"}
Here is the log
2017-01-22 12:55:57.351 [ItemStateChangedEvent ] - harmonyhub_hub_Wohnzimmer_currentActivity changed from PowerOff to SteamLink
2017-01-22 12:55:58.117 [ItemCommandEvent ] - Item 'r135c' received command ON
2017-01-22 12:55:58.122 [ItemStateChangedEvent ] - r135c changed from OFF to ON
2017-01-22 12:56:30.546 [ItemStateChangedEvent ] - Online_Desktop changed from OFF to ON
2017-01-22 12:59:37.998 [ItemStateChangedEvent ] - harmonyhub_hub_Wohnzimmer_currentActivity changed from SteamLink to PowerOff
2017-01-22 12:59:38.006 [ItemCommandEvent ] - Item 'Wake_SteamMachine' received command OFF
2017-01-22 12:59:51.424 [ItemStateChangedEvent ] - Online_Desktop changed from ON to OFF
The PC goes correct down with a Script in Windows, the Status with Network-Health is also correct.
Only the remote power plug (r135c) doesn´t power off after 10 seconds if no ping comes back.
There is no r135 OFF command recieved.
So there is something wrong in my rule…?
Thanks for any help