[SOLVED] Error in subtraction rule

I have a simple rule that is supposed to subtract “100” from an item value, and write it to a new item.

rule "Smooth Watts3"
 Item Watts3 changed 
    var Number Watts30 = Watts3.state as DecimalType
    var Number Watts31 = Watts30 - 100;
if(Watts3.state > 100 || Watts3.state < 200)    

rule errors out with:

[ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Smooth Watts3': 'postUpdate' is not a member of 'java.lang.Number'; line 78, column 5, length 27

where is the mistake?
the value of Watts3 is in format: “123.123”

ah, the mistake is that item name Watts31 cannot be same as var value Watts31, changed it to something different and it works.

1 Like