[SOLVED] Energy Rule - postUpdate ambiguous feature call

Hi,

Normally I tend to figure stuff out for myself but I have had this rule working for months and now either somethings changed or I have changed something inadvertently.

The following is showing an error in VSCode - post Update - Ambiguous feature call

rule "Update power Consumption"
    when
    Time cron "0 0 0 1/1 * ? *"
    then
    MainSupplykWh.postUpdate(MainSupplykWh.state as Number)
    MainSupplykWh_Yesterday.postUpdate(MainSupplykWh.deltaSince(now.minusDays(1)))
    MainSupplykWh_Week.postUpdate(MainSupplykWh.deltaSince(now.minusWeeks(1)))
    MainSupplykWh_Month.postUpdate(MainSupplykWh.deltaSince(now.minusMonths(1)))
    MainSupplykWh_Year.postUpdate(MainSupplykWh.deltaSince(now.minusYears(1)))
end

This is also not working with the same error…

rule "Update power consumption"
when
		Item MainSupplykWh changed
then
    MainSupplykWh_Today.postUpdate( MainSupplykWh.deltaSince( now.withTimeAtStartOfDay() ) )
end

Any ideas would be extremely appreciated.

Thanks

Tim

Which line?

Log out the result of the deltaSince calls. What is it returning? Is it null?

How do the Rules perform when loaded into OH? Do they run? Do the files fail to load? Generate errors when they run?

Hi,

There are errors on lines 6 to 9 under postUpdate as well as under postUpdate on the 2nd rule.
The rules are not running and yes the calls are returning NULL.

Subsequent rules that require data from these rules are obviously not working. However other rules files are fine and running. Its only a file called energy.rules that is affected. I have created a new energy.rules and just put in these specific two rules (thinking a corrupt file) and still the same error.

NULL is different from null. NULL is a special state that indicates that an Item has not be initialized since OH started. null means “no result”. If the deltaSince methods are returning “null” that means that there is something wrong with your persistence. That needs to be the focus of your investigations.

Ok I found an error in the Influxdb.persist file. It was persisting the wrong item names. Part of a longer story but that is now correct and I have re-started openhab.

Still the same errors though. Will keep looking.