Getting EValidator java dump after upgrade to OH 2.4 - running my Set Default.rules

Yes Rich’s explanation is correct. These errors happen sometimes (Not all the time) at system start-up. This is because the start-up process is not a sequence but things start in parallel.
Sometimes the system tries to run a rule when not all the “vocabulary” has been loaded yet. In your case sendMail. But sometimes I see the same message for item names or even ON not recognized.

These errors are not critical. The devs are working on the start-up “sequence” issues and it should be resolved eventually. In the mean time ignore these errors. After start-up, as you say, these rules should be running just fine.

2 Likes

Thanks Vincent!

But what about the java core dump of the EValidatior?
Does your explanation include this behaviour as well?

Would it make sense to put a delay into the rules file?

Thanks for a final comment!

Cheers
Justus

Yes

No

Why are you using `Thread::sleep(3000) again and again?
What are you hoping to achieve with that?

When I am logging data into the log file it mostly logs the previous value as it always takes some time before the item has the updated value. And to be sure that I am logging the new value I am waiting for 3 seconds before I initiate the logging command …

And of course I need to do that in every path of the if branches …

If there is a better way to accomplish that, I am happy for any suggestion :wink:

createTimer has a very uncomfortable syntax.
That is why I used the Thread::sleep(3000) command.

The problem with Thread::sleep is that it “locks” that thread and the system only have 5 in total.

250ms should be enough time to update an item value on the event bus.
Thread::sleep should be avoided if more that 500ms

Group you items updates together, wait 250ms and do you logInfo together

Try this:
I put the whole rule in a timer after 5 seconds, that replaces the first Thread:sleep(5000)
Then I group the postupdates (First batch together) wait 250ms and do the logInfos
The you have the if statements. Again only do the item update and then at the end of the rule post the logInfos together after waiting 250ms.

Your rule should now take 20ms to run. Time to create the timer
When timer executes, it should take not more than 1s in total to run. instead of your previous systax that was monoplolising a thread for at least 29 seconds

rule "Set Default Values"
when
        System started
then
    createTimer(now.plusSeconds(5), [ | //Thread::sleep(5000) // let persistence finish restoring a few seconds
        logInfo("FILE", "***** SET_DEFAULTS starting: Setting System Defaults at openHAB2 startup or recycle *****")

        // Standard Luftdruckwert für Ginsheim
        STDPres.postUpdate(1013.25)

        // Standard Kalibrierwert für Devolo Sensor setzen
        WzTempCalibWert.postUpdate(0.6)
        WzHumiCalibWert.postUpdate(-7.0)

        // Standard Temperatur für das Wohnzimmer setzen
        comfGruppeEGtemp.postUpdate(22.9)

        Thread::sleep(250) // let persistence finish restoring a few seconds

        logInfo("FILE", "***** Standard Luftdruckwert STDPres wird gesetzt auf Default: " + STDPres.state)
        logInfo("FILE", "***** WzTempCalibWert wird gesetzt auf Default: " + WzTempCalibWert.state)
        logInfo("FILE", "***** WzHumiCalibWert wird gesetzt auf Default: " + WzHumiCalibWert.state)
        logInfo("FILE", "***** comfGruppeEGtemp wird gesetzt auf Default: " + comfGruppeEGtemp.state)

        // Setting default for Wasserdruck Notification
        if (EmailStatusDruck.state != NULL) logInfo("FILE", "***** EmailStatusDruck ist gesetzt mit dem Wert: " + EmailStatusDruck.state)

	    if (EmailStatusDruck.state == NULL) {
            EmailStatusDruck.postUpdate("off")
            logInfo("FILE", "***** EmailStatusDruck hatte noch keinen Wert und wird gesetzt auf: " + EmailStatusDruck.state)
        }

        // Setting default for MamaIstKalt
        MamaIstKalt.postUpdate(0)
    
        // Setting default for PartyPauseModus
        PartyPauseModus.postUpdate(0)

        // Setting default for ManualOverWrite
        ManualOverWrite.postUpdate(0)

        // Setting Min und Max Werte für Heizungsdruck Chart
        minBudHeizDruck.postUpdate(0)
        maxBudHeizDruck.postUpdate(2.5)

        // Online Status von Sensor und Thermostaten abfragen und in Variablen setzen
        var wz_status = getThingStatusInfo("zwave:device:73a3cf04:node2").getStatus()
        ZwaveWzStat.postUpdate(wz_status.toString())

        var gh_status = getThingStatusInfo("zwave:device:73a3cf04:node3").getStatus()
        ZwaveGhStat.postUpdate(gh_status.toString())

        var statavm1 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CdgEZstat.postUpdate(statavm1.toString())

        var statavm2 = getThingStatusInfo("avmfritz:Comet_DECT:fritzbox:SOME_FB_AIN").getStatus()
        DevCD3CogBZstat.postUpdate(statavm2.toString())

        var statavm3 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CegKstat.postUpdate(statavm3.toString())

        var statavm4 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CegWZFstat.postUpdate(statavm4.toString())

        var statavm5 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CegWZTstat.postUpdate(statavm5.toString())

        // Kontrolle ob Devolo Sensor (Wohnzimmer) online ist
        if (wz_status.toString() == 'OFFLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: The zWave Thing << Devolo Sensor >> is " + wz_status)
            val message = "SET_DEFAULTS Rule: Devolo Sensor (Wohnzimmer) is >> " + wz_status + " <<. Please consider rebooting the Docker container !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Devolo Sensor (WZ) is " + wz_status + " !!!", message)
        }
        if (wz_status.toString() == 'ONLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: zWave Thing << Devolo Sensor (Wohnzimmer) >> is " + wz_status)
            val message = "SET_DEFAULTS Rule: Devolo Sensor (Wohnzimmer) is >> " + wz_status + " <<. Nothing to do !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Devolo Sensor (WZ) is " + wz_status + " !!!", message)
        }

        // Kontrolle ob Fibaro Sensor (Gartenhaus) online ist
        if (gh_status.toString() == 'OFFLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: The zWave Thing << Fibaro Sensor (Gartenhaus) >> is " + gh_status)
            val message = "SET_DEFAULTS Rule: Fibaro Sensor (Gartenhaus) is >> " + gh_status + " <<. Please consider rebooting the Docker container !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Fibaro Sensor (GH) is " + gh_status + " !", message)
        }
        if (gh_status.toString() == 'ONLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: zWave Thing << Fibaro Sensor (Gartenhaus) >> is " + gh_status)
            val message = "SET_DEFAULTS Rule: Fibaro Sensor (Gartenhaus) is >> " + gh_status + " <<. Nothing to do !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Fibaro Sensor (GH) is " + gh_status + " !", message)
        }

        // Korrigieren der Außentemperatur
        corrBudAussen.postUpdate((istBudAussen.state as DecimalType) - 1.3)
        logInfo("FILE", "***** istBudAussen wird korrigiert auf: " + corrBudAussen.state)

        // repeat 'if' for other items

        Thread::sleep(250) // let persistence finish restoring a few seconds
        logInfo("FILE", "***** MamaIstKalt wird gesetzt auf Default: " + MamaIstKalt.state)
        logInfo("FILE", "***** PartyPauseModus wird gesetzt auf Default: " + PartyPauseModus.state)
        logInfo("FILE", "***** ManualOverWrite wird gesetzt auf Default: " + ManualOverWrite.state)
        logInfo("FILE", "***** minBudHeizDruck wird gesetzt auf Default: " + minBudHeizDruck.state)
        logInfo("FILE", "***** maxBudHeizDruck wird gesetzt auf Default: " + maxBudHeizDruck.state)

        logInfo("FILE", "***** SET_DEFAULTS finished: Setting System Defaults at openHAB2 startup or recycle *****")
    ])
end
2 Likes

Thanks Vincent, I will try that … also good to know that 250ms should be sufficient for storing the values right before logging them :wink:

I must admit that with OH 2.4 I got several times some “Low configured threats” warnings and I new that Thread is not the best way but I did not knew better.

Now, I do! Thank you!!!

I have actually the issue in any other rule file as well. And as there are several rules per file which are triggered separately, I am using the Thread command in every rule to give some time before logging.

What would you suggest to do?

Should I simply reduce the time from 3000ms to 250ms or is there a smarter way to wait until persistence gets updated?

Changing the rule to your suggested way creates this error now:

14:18:55.355 [ERROR] [org.quartz.core.JobRunShell          ] - Job DEFAULT.2018-12-21T14:18:55.086+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XStringLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XUnaryOperationImplCustom>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>::sleep(<XNumberLiteralImpl>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@7f29917a
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@2176c63a
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  var wz_status
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var gh_status
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm1
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm2
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm3
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm4
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm5
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@a836c66
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@4c670f6
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@70fcc568
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@58ec8d29
  <XFeatureCallImplCustom>.postUpdate(<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  <XFeatureCallImplCustom>::sleep(<XNumberLiteralImpl>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XStringLiteralImpl>)
} ] threw an unhandled Exception: 
java.lang.reflect.UndeclaredThrowableException: null
	at com.sun.proxy.$Proxy170.apply(Unknown Source) ~[?:?]
	at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
Caused by: org.eclipse.smarthome.model.script.engine.ScriptExecutionException: The name 'MamaIstKalt' cannot be resolved to an item or type; line 55, column 11, length 11
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:141) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:865) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:224) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:768) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
	... 4 more
14:18:55.381 [ERROR] [org.quartz.core.ErrorLogger          ] - Job (DEFAULT.2018-12-21T14:18:55.086+01:00: Proxy for org.eclipse.xtext.xbase.lib.Procedures$Procedure0: [ | {
  logInfo(<XStringLiteralImpl>,<XStringLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XUnaryOperationImplCustom>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>::sleep(<XNumberLiteralImpl>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@7f29917a
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@2176c63a
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  <XFeatureCallImplCustom>.postUpdate(<XNumberLiteralImpl>)
  var wz_status
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var gh_status
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm1
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm2
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm3
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm4
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  var statavm5
  <XFeatureCallImplCustom>.postUpdate(<XMemberFeatureCallImplCustom>)
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@a836c66
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@4c670f6
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@70fcc568
  org.eclipse.xtext.xbase.impl.XIfExpressionImpl@58ec8d29
  <XFeatureCallImplCustom>.postUpdate(<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  <XFeatureCallImplCustom>::sleep(<XNumberLiteralImpl>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XBinaryOperationImplCustom>)
  logInfo(<XStringLiteralImpl>,<XStringLiteralImpl>)
} ] threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception.
	at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [107:org.eclipse.smarthome.core.scheduler:0.10.0.oh240]
Caused by: java.lang.reflect.UndeclaredThrowableException
	at com.sun.proxy.$Proxy170.apply(Unknown Source) ~[?:?]
	at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
	... 1 more
Caused by: org.eclipse.smarthome.model.script.engine.ScriptExecutionException: The name 'MamaIstKalt' cannot be resolved to an item or type; line 55, column 11, length 11
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.invokeFeature(ScriptInterpreter.java:141) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:902) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:865) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:224) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:768) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:220) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter._doEvaluate(XbaseInterpreter.java:447) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.doEvaluate(XbaseInterpreter.java:228) ~[?:?]
	at org.eclipse.smarthome.model.script.interpreter.ScriptInterpreter.doEvaluate(ScriptInterpreter.java:226) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.internalEvaluate(XbaseInterpreter.java:204) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.XbaseInterpreter.evaluate(XbaseInterpreter.java:190) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.ClosureInvocationHandler.doInvoke(ClosureInvocationHandler.java:46) ~[?:?]
	at org.eclipse.xtext.xbase.interpreter.impl.AbstractClosureInvocationHandler.invoke(AbstractClosureInvocationHandler.java:29) ~[?:?]
	at com.sun.proxy.$Proxy170.apply(Unknown Source) ~[?:?]
	at org.eclipse.smarthome.model.script.internal.actions.TimerExecutionJob.execute(TimerExecutionJob.java:49) ~[?:?]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[?:?]
... 1 more

I moved back to my original rule version and reduced the Thread calls before logging down to 300ms and the first one to 2500ms … I don’t get anymore the last shown java dump and the first one less frequent … I will try to prevent any further usage of the Thread command …

It has nothing to do with persistence.
When an item receives an update, it takes a bit of time for it’s state to actually change.

In your rules do the logInfo before the postUpdate instead of the other way around
This way you don’t have to wait
For example:

logInfo("ITEM UPDATE", "Heating updated to 10")
Heating.postUpdate(10)

Actually you don’t need that timer or sleep at the beginning of the rule.
Do this:

rule "Set Default Values"
when
        System started
then
        logInfo("FILE", "***** SET_DEFAULTS starting: Setting System Defaults at openHAB2 startup or recycle *****")

        // Standard Luftdruckwert für Ginsheim
        STDPres.postUpdate(1013.25)

        // Standard Kalibrierwert für Devolo Sensor setzen
        WzTempCalibWert.postUpdate(0.6)
        WzHumiCalibWert.postUpdate(-7.0)

        // Standard Temperatur für das Wohnzimmer setzen
        comfGruppeEGtemp.postUpdate(22.9)

        Thread::sleep(250) // let persistence finish restoring a few seconds

        logInfo("FILE", "***** Standard Luftdruckwert STDPres wird gesetzt auf Default: " + STDPres.state)
        logInfo("FILE", "***** WzTempCalibWert wird gesetzt auf Default: " + WzTempCalibWert.state)
        logInfo("FILE", "***** WzHumiCalibWert wird gesetzt auf Default: " + WzHumiCalibWert.state)
        logInfo("FILE", "***** comfGruppeEGtemp wird gesetzt auf Default: " + comfGruppeEGtemp.state)

        // Setting default for Wasserdruck Notification
        if (EmailStatusDruck.state != NULL) logInfo("FILE", "***** EmailStatusDruck ist gesetzt mit dem Wert: " + EmailStatusDruck.state)

	    if (EmailStatusDruck.state == NULL) {
            EmailStatusDruck.postUpdate("off")
            logInfo("FILE", "***** EmailStatusDruck hatte noch keinen Wert und wird gesetzt auf: " + EmailStatusDruck.state)
        }

        // Setting default for MamaIstKalt
        MamaIstKalt.postUpdate(0)
    
        // Setting default for PartyPauseModus
        PartyPauseModus.postUpdate(0)

        // Setting default for ManualOverWrite
        ManualOverWrite.postUpdate(0)

        // Setting Min und Max Werte für Heizungsdruck Chart
        minBudHeizDruck.postUpdate(0)
        maxBudHeizDruck.postUpdate(2.5)

        // Online Status von Sensor und Thermostaten abfragen und in Variablen setzen
        var wz_status = getThingStatusInfo("zwave:device:73a3cf04:node2").getStatus()
        ZwaveWzStat.postUpdate(wz_status.toString())

        var gh_status = getThingStatusInfo("zwave:device:73a3cf04:node3").getStatus()
        ZwaveGhStat.postUpdate(gh_status.toString())

        var statavm1 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CdgEZstat.postUpdate(statavm1.toString())

        var statavm2 = getThingStatusInfo("avmfritz:Comet_DECT:fritzbox:SOME_FB_AIN").getStatus()
        DevCD3CogBZstat.postUpdate(statavm2.toString())

        var statavm3 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CegKstat.postUpdate(statavm3.toString())

        var statavm4 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CegWZFstat.postUpdate(statavm4.toString())

        var statavm5 = getThingStatusInfo("avmfritz:FRITZ_DECT_300:fritzbox:SOME_FB_AIN").getStatus()
        DevFD3CegWZTstat.postUpdate(statavm5.toString())

        // Kontrolle ob Devolo Sensor (Wohnzimmer) online ist
        if (wz_status.toString() == 'OFFLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: The zWave Thing << Devolo Sensor >> is " + wz_status)
            val message = "SET_DEFAULTS Rule: Devolo Sensor (Wohnzimmer) is >> " + wz_status + " <<. Please consider rebooting the Docker container !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Devolo Sensor (WZ) is " + wz_status + " !!!", message)
        }
        if (wz_status.toString() == 'ONLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: zWave Thing << Devolo Sensor (Wohnzimmer) >> is " + wz_status)
            val message = "SET_DEFAULTS Rule: Devolo Sensor (Wohnzimmer) is >> " + wz_status + " <<. Nothing to do !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Devolo Sensor (WZ) is " + wz_status + " !!!", message)
        }

        // Kontrolle ob Fibaro Sensor (Gartenhaus) online ist
        if (gh_status.toString() == 'OFFLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: The zWave Thing << Fibaro Sensor (Gartenhaus) >> is " + gh_status)
            val message = "SET_DEFAULTS Rule: Fibaro Sensor (Gartenhaus) is >> " + gh_status + " <<. Please consider rebooting the Docker container !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Fibaro Sensor (GH) is " + gh_status + " !", message)
        }
        if (gh_status.toString() == 'ONLINE') {
            logInfo("FILE", "***** SET_DEFAULTS: zWave Thing << Fibaro Sensor (Gartenhaus) >> is " + gh_status)
            val message = "SET_DEFAULTS Rule: Fibaro Sensor (Gartenhaus) is >> " + gh_status + " <<. Nothing to do !!!"
            sendMail("bla@yahoo.kx", "SET_DEFAULTS: Fibaro Sensor (GH) is " + gh_status + " !", message)
        }

        // Korrigieren der Außentemperatur
        corrBudAussen.postUpdate((istBudAussen.state as DecimalType) - 1.3)
        logInfo("FILE", "***** istBudAussen wird korrigiert auf: " + corrBudAussen.state)

        // repeat 'if' for other items

        Thread::sleep(250) // let persistence finish restoring a few seconds
        logInfo("FILE", "***** MamaIstKalt wird gesetzt auf Default: " + MamaIstKalt.state)
        logInfo("FILE", "***** PartyPauseModus wird gesetzt auf Default: " + PartyPauseModus.state)
        logInfo("FILE", "***** ManualOverWrite wird gesetzt auf Default: " + ManualOverWrite.state)
        logInfo("FILE", "***** minBudHeizDruck wird gesetzt auf Default: " + minBudHeizDruck.state)
        logInfo("FILE", "***** maxBudHeizDruck wird gesetzt auf Default: " + maxBudHeizDruck.state)

        logInfo("FILE", "***** SET_DEFAULTS finished: Setting System Defaults at openHAB2 startup or recycle *****")
end

But I am logging the actual state of the item in my logging command (see below) to confirm that it has the right value.

        logInfo("FILE", "***** PartyPauseModus wird gesetzt auf Default: " + PartyPauseModus.state)

With your approach I have no verifcation that the value was set.

But why?
The system logs that anyway

Paranoia?

I thought it is ok to log the state after the change to verify that it is really changed - not knowing that the Thread timer is so costly and blocking …

It is ok, but the system does that for you regardless in your events.log
Let openHAB do it for you

Will do :slight_smile: I think it is time to build some faith and trust …

Look in events.log for that if you must have this security blanket. But in all the years I’ve used OH I’ve never encountered a case where a postUpdate did not update an Item.

Thanks Rich,

I will start replacing the Thread commands with the timerCreate but the syntax of the timer is not very convenient and error-prone missing brackets or the pipe and so on …

Thanks for clarifying that Thread is so “destructive” …

Use VSCode. It will do half of the typing for you and tell you when you are missing closing brackets and pipes and the like.

But also realize that Thread::sleep and Timer are two very different things. Timers are the appropriate thing to use in this case, regardless of how awkward you find using them.