openhab / openhab-core

Core framework of openHAB
https://www.openhab.org/
Eclipse Public License 2.0
904 stars 419 forks source link

[OH3] Chart only with 0 as values #1781

Closed lolodomo closed 3 years ago

lolodomo commented 3 years ago

Now that I can display charts, charts are containing only 0 values. If I use the persistence API to request the last data for one of these temperature items, I get values. image

kaikreuzer commented 3 years ago

I just upgraded my system and saw the same. How shall we solve it? @ghys As you mention other tools in the UI being broken by this, I assume we best strip off the unit from the state here and define that the REST API always responds with the items' default unit?

ghys commented 3 years ago

I have now downgraded to the M1 version of the rrd4j bundle and I'm back to acceptable perf levels again: (see ~60ms vs 3.5s)

image

ghys commented 3 years ago

How shall we solve it? @ghys As you mention other tools in the UI being broken by this, I assume we best strip off the unit from the state here and define that the REST API always responds with the items' default unit?

That would solve the problem, note that I don't have a problem with parsing the number with the unit attached (the client can split on " " and take the first part) but the most severe issue is the performance degrading (https://github.com/openhab/openhab-addons/pull/8866#issuecomment-719944078). (sorry my reply above was meant for this other issue).

kaikreuzer commented 3 years ago

That would solve the problem, note that I don't have a problem with parsing the number with the unit attached (the client can split on " " and take the first part)

I nonetheless think it makes sense to define that historic states are always in the default unit - because otherwise, you would have to deal with changing unit on client side and that would imho be highly complicated. We also use the unit from the item state description and show that normally in the legend - so that would be all clean. I've created https://github.com/openhab/openhab-core/pull/1782 for that.

I have now downgraded to the M1 version of the rrd4j bundle and I'm back to acceptable perf levels again

Could you please create a separate issue for it? Maybe you can also directly attach an rrd4j database file, so that it can be easily reproduced.

lolodomo commented 3 years ago

I installed snapshot 1998 and removed all my rrd files. Values are still 0 in the charts.

lolodomo commented 3 years ago

Can the issue be reopened please.

lolodomo commented 3 years ago

@kaikreuzer : did you check ? Still not working for me with snapshot 2003.

kaikreuzer commented 3 years ago

I just upgraded to 2003 and can confirm the issue - or at least a similar one: All charts with Number items that have dimensions now only show 0 values. This actually was always like this, we just didn't have any persistence services that deliver QuantityTypes so far 😄 .

The issue is with the chart provider, it cannot yet handle QuantityTypes as can be seen when debug logging is enabled:

08:52:04.042 [DEBUG] [ultchartprovider.DefaultChartProvider] - Unsupported item type in chart: class org.openhab.core.library.types.QuantityType
lolodomo commented 3 years ago

This actually was always like this

You mean in OH3 I hope because it is working properly in OH2 since years.

kaikreuzer commented 3 years ago

No, OH2 "didn't have any persistence services that deliver QuantityTypes".

lolodomo commented 3 years ago

I mean charts with these number with dimensions are working in OH2. Do you need a screen capture ?

kaikreuzer commented 3 years ago

No, as mentioned above, everything is totally clear.

kaikreuzer commented 3 years ago

Just retested with build 2004 and the charts are working smoothly for me now.

lolodomo commented 3 years ago

Charts are back for me too. Thank you Kai.