[SOLVED] Problem with calculating numbers: Couldn't invoke 'assignValueTo' for feature JvmVoid

I run into a problem what I can’t solve because I am not a developer, but I think it will be really easy to you. I have problem with calculating numbers (milliseconds).

I get the following error message:

[ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Fireplace floor heating': An error occurred the script execution: Couldn't invoke 'assignValueTo' for feature JvmVoid:  (eProxyURI: custom.rules#|::

Item definition:

Number Temp_Outside "Kinti hőmérséklet [%.1f °C]" (Temperatures, Outside) {onewire="deviceId=28.E28596060000;propertyName=temperature"}

the Rule which trows this error:

    rule "Fireplace floor heating"
                    Time cron "0 0 0/1 1/1 * ? *"
                    if (Heating_Main_Switch.state == ON && overheating_state == 1 ){
                           overheating_living_heating = 1

                           // Calculate time based on outside temp.
                           overheating_base_time = 900
                           Number overheating_time_modifier = 0 - Temp_Outside.state as Number
                           Number overheating_time = overheating_base_time + overheating_time_modifier
                           logInfo("rules","Padló átmeneti fűtés idő: "+overheating_time)

                           createTimer(now.plusSeconds(overheating_time), [|
                                    overheating_living_heating = 0

Thank you for your support!

Where is overheating_living_heating and overheating_base_time defined?

You are missing var/val on your definitions for overheating_time_modifier and overheating_time. Perhaps you are missing them for the other two variables as well? You have to define the variable (using var for variable and val for constants).

Thank you very much. You are right the problem was the variable declaration.
Anyway, I tried to step further in calculation but I got a new error. I have to Round number but following row throws an error.

var Number overheating_time_modifier = 0
overheating_time_modifier = Math::round( 0 - (Temp_Outside.state as Number * 60 ) )
Could not invoke method: java.lang.Math.round(float) on instance: null

Why? Standard practice is you store values to what ever precision they have and then use formatting to round the value in logging and showing on the UI.

Computers are really bad at doing floating point math and rounding your values makes the problem worse.

If you insist to persist, the error tells you exactly what the problem is. Math::round expects a primitive float type but you are passing it a Number.

Math::round( 0 - (Temp_Outside.state as Number * 60)).floatValue )

I am calculating seconds for a createTimer() based on outside temperature. I am not sure, but I guess timer does not accept float number. Precision is not so important.

createTimer() , or rather something like now.plusSeconds(xx), will expect an integer.
(Some OH Number).intValue
is usually useful.