Rule with Error "Rule 'Update NG5 Rain Stats': The argument 'state' must not be null."

Any idea what i’m doing wrong…I have a weather gauge that provides absolute value in mm for the rain. I found 2 threats that solved the issue, tried to do the same but i receive an error. No clue what is wrong as it looks the same as one other rule that works without an error in the logs…

// ***************************************************************************************************
// ***************************************************************************************************
rule "Update NG5 Rain Stats"
when
Item NG5_JeelinkOutsideTX22_Rain received update
    then
        if (NG5_JeelinkOutsideTX22_Rain.state instanceof DecimalType) {
           postUpdate(RainToday, NG5_JeelinkOutsideTX22_Rain.deltaSince(now.withTimeAtStartOfDay, "influxdb"))
           postUpdate(Rain_1h, NG5_JeelinkOutsideTX22_Rain.deltaSince(now.minusHours(1), "influxdb"))
        }
end

2020-05-16 10:51:17.122 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Update NG5 Rain Stats’: The argument ‘state’ must not be null.
2020-05-16 10:51:21.617 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Update NG5 Rain Stats’: The argument ‘state’ must not be null.
2020-05-16 10:51:26.130 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Update NG5 Rain Stats’: The argument ‘state’ must not be null.
2020-05-16 10:51:30.618 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule ‘Update NG5 Rain Stats’: The argument ‘state’ must not be null.

You’ll have to expand it out to see what goes wrong, log out values to see if they are what they think you are.
Obvious candidate for trouble is the deltaSince.
Is that returning anything? If it does, is it in a suitable form to use as a postUpdate argument?

@rossko57
Sometimes it just needs somebody to listen/comment. after your comment i did dig deeper and tried many things but finally realized that (could kick myself for that) the NG_…Rain “absolute” item was not in the persistence list. jesus.

I hope that this may help others running into similar error messages. Sorry and happy that it works now :slight_smile: