I have recently upgraded to openHAB 2.5.0 Milestone 3 from M2. I am not really sure whether this has something to do with that upgrade but my previously working code has an issue at a certain point. I have found out that a
String::format statement silently fails. Here is my setup:
Number Taupunkt_Differenz "Taupunktdifferenz Δtd [%.1f °C]" <humidity>
Taupunkt_Differenz is a calculated item out of 2
rule "My rule" when Item Taupunkt_Differenz changed then val Number taupunkt_delta = Taupunkt_Differenz.state as DecimalType val td=1.2345 logInfo("myrule.rules", "td=" + td + " | taupunkt_delta=" + taupunkt_delta) var String test1 = String::format("%.1f °C", td) logInfo("myrule.rules", "test1=" + test1) var String test2 = String::format("%.1f °C", taupunkt_delta) logInfo("myrule.rules", "test2=" + test2) // this line won't be reached! // ... // (more code) // ... end
The complete log output is
2019-09-15 10:49:00.018 [INFO ] [me.model.script.myrule.rules] - td=1.2345 | taupunkt_delta=0.8502743895760965 2019-09-15 10:49:00.025 [INFO ] [me.model.script.myrule.rules] - test1=1,2 °C
and that’s it. The last
logInfo is missing. So my impression is that the second
String::format statement fails and the rule is exited without any error message because the following code is not executed.
I am quite sure that this code worked before. Does anybody have an idea what is going on here?