That parts a bad idea in Rules DSL but not related to your specific problem. Rules DSL will fight against you if you try to force the types of your variables. And it’s outright stupid in the way it handles primitives so those should be avoided unless absolutely necessary. It looks like the parsing is O(x^n) process where n is the number of primitives involved in a calculation. I had one relatively simple calculation involving primitives that added minutes to how long it takes to load that rule on a relatively well provisioned Intel machine (not an RPi).
Do not force the types of variables unless they are initialized to null meaning there is no way for the parser to infer type.
val offRollerSunrise = 45
val offRollerSunset = 45
val offRollerSunsetSZ = 120
val offLightOn = 45
val int offLateOff = 240
If you just, use Number, not primitives. In those rare cases where you do need a primitive (e.g. a call to a Java class which required a primitive) wait until the last moment and then call intValue on the Number.
Anyway, back to the problem at hand.
So those are all of the global variables?
What about lambdas?
There is no such thing as a Number:Dimensionless in rules. That should be throwing a syntatic error. Assuming Shutter_WohnZ_2sw is a Number:Dimensionless do you mean:
var pos = Shutter_WohnZ_2sw.state as QuantityType<?>
or if you want to make sure it’s a percent
var pos = (Shutter_WohnZ_2sw.state as QuantityType<?>).toUnit('%')
Also again, what about lambda’s in this file too?