[ERROR] [.internal.handler.ScriptActionHandler] - Script execution of rule with UID ‘onParentsRoomTemperatureChange-1’ failed: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.ObjectExtensions.operator_plus(java.lang.Object,java.lang.String) on instance: null in onParentsRoomTemperatureChange
But from the console, I have :
items list | grep LocalWeather_ForecastTonight_MinimumTemperature
LocalWeather_ForecastTonight_MinimumTemperature (Type=NumberItem, State=3.72 °C, Label=Température minimale de la nuit, Category=temperature, Groups=[Weather])
Where is the NULL ? (This rule has been working flawlessly for years before 3.4)
Thanks for reading and sorry in advance @rikoshak : I will say “but of course…” once you’ll have answered
(edited to reduce the problem on advice of Matthias)
You are working here with two items, but only have shown that you have tested one of them.
What about the other item? Most likely it also has a UoM .
Of that’s not helping, as a workaround you can try to store both values into variables first, maybe that’s helpful to see where the error is coming from.
When Rules DSL cannot figure out how to convert one of the operands to an operation to be compatible with the other, it gets a null error like this. It doesn’t mean that the operand is actually literally null, but after attempting to cast or manipulate the state Rules DSL ended up with null.
How Rules DSL does this is it takes the first operand as the base type and it only tries to manipulate the second operand.
The type of LocalWeather_ForecastTonight_MinimumTemperature.state is State. State doesn’t support operations like +. It’s trying to convert the + to become a String (which is why it’s trying to use operator_plus(Object, String)) but can’t convert 3|°C to a String and therefore fails with null.