I need my rule to do something if it gets a timeout while executing a script using executeCommandLine.
I’ve tried wrapping it in a try{} catch{} but it does’t look like that gets called.
Ta
I need my rule to do something if it gets a timeout while executing a script using executeCommandLine.
I’ve tried wrapping it in a try{} catch{} but it does’t look like that gets called.
Ta
This is the script I’ve tried:
rule "Test Alarm"
when
Item Test_ZWave changed to ON
then
var error = false
try {
var result = executeCommandLine("/home/ross/script.d/testAlarm.sh",2000)
logInfo("Alarm",result)
if(result == "ok")
{
sendTelegram("Alarm_bot", "Alarm all good!")
}
else
{
sendTelegram("Alarm_bot", "Alarm broken!")
}
} catch(Throwable t) {
logInfo("Alarm","ERROR")
error = true
}
if(error)
{
sendTelegram("Alarm_bot", "Alarm broken!")
}
end
Does anyone have any ideas? I’m guessing this is something really obvious that I’m missing!