Hi,
After OH3 upgrade I have 2 rules that are writing errors in the log, but they actually work (items get updated accordingly)
I dont know if I should ignore this…would prefer to try and fix it, as I don’t know if these things affect performance and stability
the error I mostly get:
[ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'energy-2' failed: Script interpreter couldn't be obtain in energy
error i once caught but during startup so it might be irrelevant, maybe item was not loaded…
rule with UID 'energy-3' failed: Could not cast NULL to org.openhab.core.library.types.DecimalType; line 43, column 27, length 30 in energy
2 rules that are doing this:
rule "Energy Usage Today"
when
Item kWh received update
then
kWh_Today.postUpdate ((kWh.deltaSince(now.with(LocalTime.of(0,0,0,0)))).floatValue)
kWh_Month.postUpdate ((kWh.deltaSince(now.minusDays(30))).floatValue)
end
rule "Calculate Energy Price"
when
Item kWh changed
then
var Number kWhMonth = kWh_Month.state as DecimalType
var Number kWhMonthPrice = kWhMonth * 0.268;
kWh_Month_Price.postUpdate(kWhMonthPrice)
end
all Items involved are type Number.
I think the error only appears during startup or during modifying the rules file, when the whole energy.rules gets reloaded in this case, triggering the error of the mentioned 2 rules.
Most of the mentions of this message are old (OH1), surprising to see it crop up in OH3.
But I think that’s a clue it is more about rules management, than execution.
So far as I can make out the message “means” something has gone wrong, but maybe because of timing, you’re not getting the real message.
Leaving guesswork.
Commonly associated with rule syntax errors.
And there’s a unusual syntax, we don’t usually use ; in DSL.
There are suggestions that once you get this message attached to a rule, it won’t go away until a reboot (and you’ve fixed the cause, obviously).