Retrieved from persistence has no unit since 4.2

After I moved to 4.2, I have a repeating weird warning from org.openhab.core.persistence.extensions.PersistenceExtensions saing

Item PVErzeugungsLeistung is QuantityType but state 704.0 at time 2024-07-13T18:16:20+02:00[Europe/Berlin] retrieved from persistence has no unit

generated by this DSL code

var Number p
p = PVErzeugungsLeistung.minimumSince(now.minusSeconds(120))

Doesn’t make sense to me … I mean of course the state retrieved from persistence has no units as persistence only stores values? p has none either.
Mark or Jan any idea ? want me to file that as a bug ?

Which persistence service?

Edit: I guess PVErzeugungsLeistung is an item which has an unit, correct?

rrd4j

yes, unit=“W”

sorry for not being explicit enough right away

This should not happen. Do you use rrd4j in the version from the 4.2 distribution? According to the code it should return a value with unit.

yes

It’s actually weird this only happens with this particular item, I have the same code work on another item without giving that output. Btw it seems to happen on several actions, .averageSince and .minimumSince among them.

The only difference I figured out so far is that PVErzeugungsLeistung is a Group, luckily it’s a text defined one so I can show the full definition:
Group:Number:Power:SUM PVErzeugungsLeistung "gesamte PV-Leistungserzeugung" <energy> (PV) ["Measurement","Power","Inverter"] { stateDescription=" "[ pattern="%.0f W" ], unit="W" }

Does that group info explain anything ?
I also tried to reproduce the issue with a new item (even a group item via UI) but so far I fail to.
Will restart OH as a next troubleshooting step but I’m hesitant as it’s my prod system plus I think I had already tried that.

Found it. It’s a bug in RRD4J.

5 Likes

Can you try update org.openhab.persistence.rrd4j https://download.smarthomej.org/org.openhab.persistence.rrd4j-4.3.0-SNAPSHOT.jar? That should solve your issues. Cf. [rrd4j] Fix unit retrieval for group items by J-N-K · Pull Request #17054 · openhab/openhab-addons · GitHub

3 Likes

Yes that fixed it.

Great work and super fast even, thanks a lot for that !

(now go relax and have a coffee :slight_smile: it’s sunday).

Same issue here no real production impact though.
However my log file is now flooded with the warning messages, anyway to turn it off until a fix is released? Many thanks

1 Like

hi folks, is there any workaround for this issue?

kind regards, Peter

The fix was merged three weeks ago. So the work around is to upgrade to any OH 4.3 snapshot released in teh past three weeks. Or wait for OH 4.3 M1 which should be released relatively soon (days to a couple weeks). Or wait for OH 4.3 release in December.

This PR has not been cherry picked for release in 4.2.1 as of now. So an upgrade is the only way to get the fix.

It’s been less than a month since 4.2 was released so upgrading to the snapshot so there are not many changes that might trip you up. Then you can continue to follow the snapshots or wait for the next mileston or full release to upgrade OH.

thank you very much, i upgrade to 4.3-snapshot. i like the new features of 4.2 and do not like downgrade to 4.1.1

It actually has been cherry-picked, so it will be included in 4.2.1.

1 Like

I saw that it was added to the 4.3 milestone but didn’t see anywhere that it was cherry picked. That’s good news.

Isn’t the plan to put everything in 4.2.1 that currently is tagged as patch, 21 PRs or so these are?
@J-N-K recommended backporting this, too.

The process is to add the patch label after cherry-picking the commit into branch 4.2.x. So currently all PR’s with milestone 4.3 and label patch should indeed be included in 4.2.1.

1 Like

release 4.2.1 fix the issue. Thank you very much!!!

I just noticed this , not sure my issue is related There is no queryable persistence service registered with the id ‘jdbc’