I’m running openHAB 3.4.4 and am currently writing a rule that does a couple of arithmetic calculations around energy consumption, PV energy generation, autonomy grade etc. In that context I’m facing one very odd problem.
If (example)…
- … in code line #1, I perform an arithmetic calculation (e.g. converting from W into Wh)…
- … and then, in the subsequent code line #2, I write the result into the log…
- … the result is often still the previous (old) result, as if the calculation in line #1 was not yet finished when the result was written into the log in line #2.
Is there a way to fix this, e.g. only continue with the next line of code only after the previous line of code (calculation) has been completed?
Of course I could tell the code to just wait for e.g. 1 second, but this seems like a rather coarse hack.