Timer, Reschedule und Countdown...
das ist mein aktueller Stand welcher bis zum abgelaufenen 30sek Timer funktioniert denn "Shelly1_04.sendCommand(OFF)" wird noch ausgeführt.
Aber dann gibts ne Fehlermeldung im Log:
Code: Alles auswählen
2020-10-28 20:59:37.588 [ERROR] [org.quartz.core.JobRunShell ] - Job DEFAULT.2020-10-28T20:59:35.159+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
org.eclipse.xtext.xbase.impl.XIfExpressionImpl@1a7d783
} ] threw an unhandled Exception:
java.lang.NullPointerException: cannot invoke method public abstract boolean org.eclipse.smarthome.model.script.actions.Timer.reschedule(org.joda.time.base.AbstractInstant) on null
Code: Alles auswählen
var Timer tCheck = null // globale Variablen zu Beginn der Datei definieren
var int versuche = 3
rule "Satreceiver Startup Check"
when
Item Shelly1_04 changed to ON // SAT eingeschaltet
then
logInfo("Coolstream Startup Check","Coolstream eingeschaltet, warte auf hochfahren.")
tCheck?.cancel // eventuell laufenden Timer stoppen
versuche = 3 //reset iterations
createTimer(now.plusSeconds(30), [| // lege Timer an
if (CoolstreamTime.toString.contains ("offline") && ShellyPlugS_04_Proxy.state==ON) { // offline = Satreceiver ist nicht hochgefahren //am Denon hängt noch der Switch
Shelly1_04.sendCommand(OFF) // schalte ab wenn CoolstreamTime "offline" behinhaltet
logInfo("Coolstream Startup Check","Coolstream offline, schalte noch mal ab.")
versuche = versuche - 1 //Count down
if(versuche > 0)
tCheck.reschedule(now.plusSeconds(10)) //reschedule timer
Shelly1_04.sendCommand(ON)
logInfo("Coolstream Startup Check","Coolstream offline, schalte noch mal ein.")
}
])
end