Strange behaviour with InfluxDB peristence of Switch-States

  • Platform information:
    • Hardware: Raspberry PI 2b
    • OS: Raspberrian
    • Java Runtime Environment: 11
    • openHAB version: 3.0

I just upgraded my OpenHAB version from 2.5 to 3.0 and migrated my Things and Items configuration from file-based to UI based.
Now I’m trying to move my charts from grafana to using the default openhab charts.

I already know how to use the “influxdb-persist” file and also manged to store values within my influx db.

I want to store the state of some switches whenever theit state changed. Thats working fine as you can see in the screenshot of a query to that data in the command-line at the end of my post.

As you can see the states “ON/OFF” are corretly converted to “1/0”.
There are 3 values persisted. Everything seems fine.

The strange thing is, that when I want to “Analyse” the data the charts are empty.
Also, when I create a new chart and manually add the series of the switch, I only see “NaN” values (Screenshot at the end of this post)

I added the DataTable to the output of the chart and there I also see only “NaN” values.

I tried the API-Explorer to use the REST-API to request the data of the item and got strange results.

  • I get 5 da* tapoints returned (there should be only 3)
  • All 5 datapoints have the state “OFF” (2 of 3 should be OFF and one should be ON)

I already searched this forum here and the internet in general and still couldn’t find any solution for my problem.
I realy have no clue of what I’m doing wrong.

Is here anyone who could give e a hint ?

Here are the screenshots (sorry I as a newbie can only upload one image :frowning:)

Best regards Christian

This is exactly the same issue as I have. But I started with a fresh OH3 install.

Charting in grafana is no issue.
States are persisted in influx as 1/0.
API shows current state as On/Off.

I have exactly the same problem. Data table show NaN as values… I use oh3.1 snapshot, but the Analyse function show the correct values as Diagramm. When I save this chart I can work on it without problems. Second problem is, and I think you have the same problem, the tool tip and the legend shows the item twice. I use rrd4j for persist this items.

@ysc: do you have an idea about this problem?

Hm, no, sorry. Maybe there are two items with the same label?

Ok, and is there a problem with charts and switches?

They work for me at least, and on, with rrd4j (ok maybe not the data table). Hard to diagnose without more context.

The demo was the reason why I started to work with a second grid:-) and than I met this problem. What kind of Information do you need?
And I think this is not a persistence problem the problem exist with influxdb and rrd4j.

Thank you for all your work!

If you take the code from!/settings/pages/chart/chart_example_combined and replace it with your items (Switch on line 47 and number on line 55) does it work?

Mhhhh, Good point. It’s running like it should. So it’s a problem on my side.
I will investigate it.

Thank You!

Meanwhile I setup a new instance of Openhab 3 on a new raspberry and changed persistence to rrd4j and now everything works fine.

Thnx for your help.

Would you be so kind and add also link to Comparison chart demo code? :wink: