Help with Rule and If Statement // Newbie Question

Hi,

I use the following rule.

rule “Temperaturkorrektur”

when

Time cron "00 15 0/1 1/1 * ? *"

then

val Zigbee_Heizkoerper1_local_temp_Number = Zigbee_Heizkoerper1_local_temp.state as DecimalType

val Zigbee_Klima_Dachboden_Temp_Number = Zigbee_Klima_Dachboden_Temp.state as DecimalType

var double Heizkoerper_Diff_Temp = (Zigbee_Klima_Dachboden_Temp_Number - Zigbee_Heizkoerper1_local_temp_Number)

logInfo("Unterschied", "= " + Heizkoerper_Diff_Temp)

    

if (Heizkoerper_Diff_Temp > 0.00 ) {

     logInfo("Unterschied groesser 0 ", "= " + Heizkoerper_Diff_Temp)

} end

As a result I get:

2020-10-14 20:15:02.409 [INFO ] [e.smarthome.model.script.Unterschied] - = 0.54

2020-10-14 20:15:02.417 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule ‘Temperaturkorrektur’: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.DoubleExtensions.operator_greaterThan(double,double) on instance: null

Can you point me to the solution, since I can calculate the Value of Heizkoerper_Diff_Temp and log it, but if is not working

Don’t try to force your interim result to double. You can generally let the rules interpreter sort types out; also Number is the closest thing to “native” type.