UnDefType in TimeSeries?

I have a use case in a binding (SMHI Weather) where I would need to include UNDEF in a forecast. In essence, some of the values have a special value that represents “N/A”, e.g., for cloud base and top altitude when there are no clouds. But the Item (Number) rejects the TimeSeries unless all states in it are either QuantityType or DecimalType. (The code for this is here: openhab-core/bundles/org.openhab.core/src/main/java/org/openhab/core/library/items/NumberItem.java at a1a92f2dcc0ab5e5f86c14622b0cd1857768af68 · openhab/openhab-core · GitHub)

The alternative approach I can see is to skip adding these values to the TimeSeries but that would mean it will not update the Items state, and instead display an outdated value.

Would it make sense to allow UNDEF (also possibly NULL) in a TimeSeries? If not, is there a good solution to prevent displaying stale values?

Persistence doesn’t support saving UnDefType so even if TimeSeries supported it, there’s nothing that would be able to store it. Therefore, adding support to UnDefType would be bigger than just adding it to TimeSeries.

The only solution I can think of that wouldn’t involve a bunch of breaking changes is to come up with some number that represents UNDEF (e.g. -1).

That’s a good point. So even if the Item would accept it, nothing would be added to persistence and the situation would still be that it doesn’t get updated.

Will have to figure out some other way then, some negative value could be a solution.