How to create "holes" in the analyze series?

I have multiple temperature sensors linked to items and from time to time, their battery runs out. Because I’m not regularly looking at the system, it may happen that hours pass between the last valid point and the new value when I have changed the batteries.

In the analyze graph, this leads to this kind of “flat line” effect:

I’d rather have a “hole” in the time series, like what can be seen when a new sensor is added to the system:

Is this possible to do? I’m not afraid of doing low level data manipulation, but I could not find any documentation on that subject.

For reference this is the version I’m using:

runtimeInfo:
  version: 3.2.0
  buildString: Release Build
locale: en-FR
systemInfo:
  javaVersion: 11.0.13
  javaVendor: Oracle Corporation
  osName: Linux
  osVersion: 5.4.164-1-MANJARO
  osArchitecture: amd64

Is the value still there? Or is it ‘null’?
What happens when you set persistence to every minute? (or an other fixed time span)?

I believe it is still there, the value is simply not updated. I mean it comes from a binding that reads wireless data coming through. If it reads a packet for a given sensor it updates the temperature value, but it does not have any “timeout” between values before setting it to null.

Well, this shows my lack of knowledge in openHAB, I don’t understand where to find this setting.
I did find this page but I’m not sure this is applying to my use case here.

Set an expire on each Item, for 2-3 times the usual reporting period. Have expire set state to 0 or 0°C or -100°C or whatever is appropriate for your visual need. You’d normally set UNDEF for situations like this, but UNDEF will not get persisted, and even if it did you can’t plot UNDEF so the charting would still fill in the gaps.

The only way to reproduce “no line at all” would be to delete all persistence data at the moment of failure, you probably don’t want to do that.

Ok, I understand the idea behind using a “weird” value, even if it means it will have the sharp fall to that -100 for instance. And the cards in the overview page may not scale well.
I can live with that, but can you tell me how to set an expire on an item? I looked through the UI and could not find it. The page I mentioned is talking about scripts, but it did not seem that obvious to me that this could be the explanation I’m looking for.

That’s too bad, I find it nice to have a “hole” when no data has come in for a long amount of time. Do you think I should create a feature request for this?

Go to the Item’s page. Click “Add Metadata” and select “Expiration Timer”.

Also I’m not sure you can achieve this in the Analyzer window which has limited options.
On a chart page however you can control charts options, in particular this one:
https://echarts.apache.org/en/option.html#series-line.connectNulls

That documentation site has a handy “Try It” link which allows you to test what the option does. Choose “line with empty data” and toggle “Enable” to see the changes.

In a chart page, the option would be added to the oh-time-series component. You can save the current state of the Analyzer window to a chart page with the Save link in the header.

I’m curious to see how that works with real persisted data? Foresee a problem because we don’t persist “nulls”, by design. Some databases would just have no available data for periods; rrd4j can have NaN values internally in its time series pigeonholes … but you can’t retrieve those. The persistence service assumes the last known “good” value still holds true.

Thanks, I did open that menu but did not register the existence of that item. It now works just fine.

Thanks, I just discovered what that “Save” button does.
I added the option like this:
image

Well, I tried leaving the value unset for the expiration timer, which gave a nice “UNDEF” value on the card in the overview. In a later experiment, I tried forcing it to “NULL”, which appeared in the same place as well.
The analyze view however, does not seem to care:
image

But that was expected as Analyze is quite limited. But as you hinted, the option for graphs did not change anything either, there is not hole in the graph itself.

That’s too bad, I’ll have to resort to the “out of place value” trick then.