Openhab-addons: [rrd4j] "Tried to set invalid state" errors when restoring values on startup

Created on 19 Oct 2020  路  14Comments  路  Source: openhab/openhab-addons

I see the following in openhab.log:

2020-10-14 16:59:40.497 [ERROR] [org.openhab.core.items.GenericItem  ] - Tried to set invalid state 0.0 (DecimalType) on item bathFans of type SwitchItem, ignoring it

The .items file is similar to:

Group:Switch:OR(ON, OFF) bathFans    "All Bath Fans [%d are on]" (all)
Switch mMainBathFan   (bathFans) {channel=""}
Switch sMasterBathFan (bathFans) {channel=""}
Switch sBathFan       (bathFans) {channel=""}
Switch bBathFan       (bathFans) {channel=""}
bug

Most helpful comment

I have found a few flaws in rrd4j and am working on fixing it - stay tuned.

All 14 comments

Do you also use mapdb to restore values on startup? The version used with OH3 was rewritten and seems to have some issues.

No, I don't use mapdb at all, is it enabled by default?

No it's not enabled by default. But I have also seen similar error logging about invalid state. I hope to find the root cause. :-)

It does appear that state is somehow persisted across restarts

It could be that you are now using rrd4j to restore the state on startup. IIRC rrd4j doesn't store the unit with quantity type items so that might cause your other issue https://github.com/openhab/openhab-core/issues/1732.

Yes, it does appear that it is installed. I didn't configure any sort of persistence. It isn't enabled:
image

I uninstalled rrd4j and the errors went away.

OK that at least explains some of the issues. When a persistence service is installed it is enabled and it will use the default persistence strategies of the service if none are configured, which seems to be storing items every minute and restoring on startup.

The default service setting is only used to determine which source should be used for charts.

I didn't install a persistence service. I'm using the conf/services/addons.cfg, and persistence isn't even defined.

It's installed by default and that is also not obvious in the setup wizard, see https://github.com/openhab/openhab-webui/pull/306#issuecomment-678621976. So it doesn't help that its default persistence strategies will now also start generating these issues for everyone out of the box.

We'd have to investigate why this happens - for me, restoring switch items works flawlessly with rrd4j.
But I guess we can assume that the problem is within the rrd4j persistence service, so I suggest to move the issue to openhab-addons.

It seems when rrd4j restores values the precision gets lost causing #8798 and it has other issues as well.

When I use the demo setup it also cannot restore the Heating item:

[ERROR] [org.openhab.core.items.GenericItem ] - Tried to set invalid state 1.0 (DecimalType) on item Heating of type SwitchItem, ignoring it

I have found a few flaws in rrd4j and am working on fixing it - stay tuned.

Was this page helpful?
0 / 5 - 0 ratings