Chart showing current value, not history

Tags: #<Tag:0x00007f4347446a88> #<Tag:0x00007f43474469c0> #<Tag:0x00007f43474468f8>

OS: Ubuntu 18.04.5 LTS

  • Java Runtime Environment: 1.8.0_151
  • openHAB version: 2.5.11-1

I am using mysql persistence, and the values are updated in the database correctly. However, when looking at the chart, it seems it always shows the current value, rather than the history.

This is the section in my sitemap.

        Group item=Patio icon="groundfloor" {
                Switch item=Sonoff_Basic
                Default item=Sonoff_Basic_Temperature
                Default item=Sonoff_Basic_Humidity
                Default item=Sonoff_Basic_DewPoint
                Chart item=Sonoff_Basic_Temperature refresh=300000 service="mysql" period=D

I found the culprit.

It’s not like the chart is showing the current value always, it’s just that it is showing the last known value for the last 6 hours. I didn’t notice it, because I just started collecting persistent data of that temperature, so I only had a few samples to display. And the 6 hours of constant value made it look like it was “stuck”.

And the reason for this was that I had the timezone configured as “UTC” in my mysql service definition (/etc/openhab2/services/mysql.cfg).


While the mysql server time zone was SYSTEM,

mysql> SELECT @@global.time_zone;
| @@global.time_zone |
| SYSTEM             |
1 row in set (0.01 sec)

and my server’s time zone was CST (-06:00)

root@josie:/etc/mysql/mysql.conf.d# date
Thu Mar  4 10:58:47 CST 2021

I just removed the ?serverTimezone=UTC part form the url, and now the chart looks good. :slight_smile: