[SOLVED] Error in subtraction rule

Hi,
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"
when
 Item Watts3 changed 
then
    var Number Watts30 = Watts3.state as DecimalType
    var Number Watts31 = Watts30 - 100;
if(Watts3.state > 100 || Watts3.state < 200)    
    Watts31.postUpdate(Watts31)
end

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