Let the DSL do it’s job. Don’t cast unless you have to and stay away from primitives…
var current_temp = 0
var delay = 0
States are never integers…
current_temp = Day1AirTemperature.getStateAs(DecimalType).intValue
delay = current_temp / 10
This will also work if Day1AirTemperature is defined as Number:Temperature.
You might want to read up on logging…
typeOf?
logInfo("my.rules", "Type of current_temp = {}", current_temp.class)
Welcome to the forum! Code fences (see #12) will help others help you!
The rules DSL is very limited. If you are just starting out, you will probably do best using a real scripting language…