openHAB chart – tooltip problems

Hi,

I have a problem with the tooltip in charts when I’m using multiple items.

For example: I’m using a chart with two items and activated tooltip. The items values have the exact same timestamp in the InfluxDB but the tooltip doesn’t show the values of both items at the same time, only one.

Platform information:
Proxmox CT
OS: Debian 11.8
Java Runtime Environment: openJDK 17.0.7
openHAB version: 4.0.3
InfluxDB version: 2.71

I’m using the Influx persistence layer as standard persistence service. The openHAB and the InfluxDB are running on different systems.

I’m experiencing the same issue.
I think it’S caused by different timestamps, since my values come from different items.
Both send via MQTT every 10s, but not synchronized.

I remember seeing this as a feature request to Apache Echarts, which is the charting library we use in Main UI.
As long as Echarts does not support interpolating values to display all series on the tooltip, I fear we can’t improve this behaviour.

I have the same issue after switching from rrd4j to mariadb.

Would it be a solution to decrease the time resolution on the database from TIMESTAMP(3) to TIMESTAMP(0)? This would result in timestamps saved with a precision of one second instead of one millisecond which seems to be the default.

I wonder why this issue does not occur with rrd4j. What is the default precision on timestamps there?

Hi y’all,

I managed to produce a work-around for this issue.
The following description works for MariaDB, but I guess it can be adapted to other SQL databases as well:

  1. Change the default persistence strategy to the following cron expresssion: 0/5 * * * * ? * Of course, you may use a different interval and add restoreOnStartup
  2. Connect to the database and create a helper table like this: CREATE TABLE tstodelete (time timestamp(3));
  3. For every item table run these statements to convert the accuracy of the timestamp from milliseconds to seconds:
-- item0001 is an example for an item table
DELETE FROM tstodelete;
INSERT INTO tstodelete 
  SELECT from_unixtime(floor(unix_timestamp(time))) as rounded 
  FROM item0001
  GROUP BY rounded 
  HAVING count(rounded) > 1;
DELETE FROM item0001 
  WHERE from_unixtime(floor(unix_timestamp(time))) 
  IN (select * from tstodelete);
ALTER TABLE item0001 MODIFY COLUMN time timestamp(0);

Of course, all of this comes without any warranty :wink:, but it worked for me.

Best regards,

Johann