RRD4J Persistence on OH2 Beta 4

Hi all,

I’m trying to set up persistence on OpenHab2 Beta 4.

I’ve done the following:
Items/my.items:

Number Living_Room_Temp "Living Room Temperature [%.1f °C]" <temperature> (Temperature_Sensors) {mqtt="<[oh2:hab/livingroom/temperature/1:state:default]"}

Persistence/my.persist:

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
    // for rrd charts, we need a cron strategy
    everyMinute : "0 * * * * ?"
    default = everyMinute
}

Items {
    // which data to be stored
    Living_Room_Temp : strategy = everyMinute
}

Services/rrd4j.cfg

# please note that currently the first archive in each RRD defines the consolidation
# function (e.g. AVERAGE) used by OpenHAB, thus only one consolidation function is
# fully supported
#
# default_numeric and default_other are internally defined defnames and are used as
# defaults when no other defname applies

#<defname>.def=[ABSOLUTE|COUNTER|DERIVE|GAUGE],<heartbeat>,[<min>|U],[<max>|U],<step>
#<defname>.archives=[AVERAGE|MIN|MAX|LAST|FIRST|TOTAL],<xff>,<steps>,<rows>
#<defname>.items=<list of items for this defname>
rrd4j:ctr5min.def=COUNTER,900,0,U,300
rrd4j:ctr5min.archives=AVERAGE,0.5,1,365:AVERAGE,0.5,7,300
rrd4j:ctr5min.items=Living_Room_Temp

Checking in the Karaf database it says:

config:property-list
   ctr5min.archives = AVERAGE,0.5,1,365:AVERAGE,0.5,7,300
   ctr5min.def = COUNTER,900,0,U,300
   ctr5min.items = Living_Room_Temp
   service.pid = org.openhab.rrd4j

Then to show the chart in my sitemap file:

Chart item=Living_Room_Temp service="rrd4j" period=12h

Yet the chart doesn’t show anything. Where have I gone wrong?

Is “my.persist” really to name of your persist-file for rrd4j? It should be “rrd4j.persist”!
You can check if vales are stored in your database via the RST API website.
Undedr the section “persistence” select “/persistence/items/{itemname}”, on the next page fill out “serviceID” with “rrd4j” and “itemname” with the itemname you expect to be persisted. A click on “Try it out!” will show you the data persisted for the last day. I suspect no data will be reported.

1 Like

Thanks Opus! I had a feeling it would be something silly.

Now my chart looks like this. Wrong, but a start

OK, I’ve now got the group onto the chart but the living room is still flat-lining at 0. Any ideas?

Did you check via REST API what values or strings are persisted ?

Btw: Why do you have one archive for values every minute thar reaches for 6:05 hours and one that holds the average of every seven minutes for a period of 35 houres? It looks to me as if you don’t use the first one

Can you explain what you mean please? My only strategy is every minute if that’s what you mean?

My chart is now working as expected for two of my three temperature sensors. The living room temperature keeps going sky high (50,000) and is reported as follows in the rest web service;

{
      "time": 1478361000000,
      "state": "42949672.7730000019073486328125"
}

If I watch the values coming in through a MQTT client the values look to be as expected.

Regarding this weird temperature reading, I have no clue. Some more stupid questions : Since the other two readings are as expected, what is the difference to the false reading? Other equipment, other item setting, …? Since you get normal readings when checking via MQTT, a broken sensor seems to be ruled out.

Regarding my question concerning your rrd4j archives, I’m just curious why you have that rather special custom setting.

The fishtank and living room temperature sensors are both DS18B20’s plugged into the same ESP8266 board. The temperature shown in the Openhab client reports as expected.

I’ve now changed my rrd4j.persist file to be this, which I think is more normal? I was just trying to start with the bare minimum settings.

// persistence strategies have a name and a definition and are referred to in t$
Strategies {
    // for rrd charts, we need a cron strategy
    everyMinute : "0 * * * * ?"
    everyHour   : "0 0 * * * ?"
    everyDay    : "0 0 0 * * ?"
    default = everyChange
}

Items {
    // which data to be stored
    Temperature_Sensors* : strategy = everyMinute, restoreOnStartup
}

The graph still looks very odd though

Since the temperature sensors are of the same type, how do you show the value on the sitemap? Is there a difference? ( I’m only fishing in the dark to find the reason for that “false” value)

The ESP sends the temperature from the two probes, as well as the voltage over MQTT on different topics, which are linked to different items.

This is how it looks in an MQTT client and in OH2, with the numbers matching:

I’m sorry, but I’m out of ideas!
I don’t understand why your LivingRoom Temperature is logging this high number (“42949672.7730000019073486328125”) and why it is drawn at zero on the graph. IMHO those two findings do not correlate.

Sometimes it does draw it at 42949672… as shown in Habmin below. There almost seems to be a pattern to the values. Sadly I can’t work out how to list my persistence in habmin to show you what it sees

OK, looking at this chart, the is no difference between the persisted values and the drawn chart.So there must be something else that is different when comparing the two temperatures that are correctly shown on the website but only one is logged correctly.
What type of item are those temperatures, both of the same? How are they defined in the .items file?

Here they are from my items file

Number Fish_Tank_Temp "Fish Tank Temperature [%.1f °C]" <temperature> (Temperature_Sensors) {mqtt="<[oh2:hab/livingroom/temperature/0:state:default]"}
Number Living_Room_Temp "Living Room Temperature [%.1f °C]" <temperature> (Temperature_Sensors) {mqtt="<[oh2:hab/livingroom/temperature/1:state:default]"}

Hi Rob
I’m experiencing problems like yours, did you find a wasy to solve the extreme temperatures?

I think my DS18B20 has now completely failed. I reflashed the ESP a few times but was getting a constant reading of -127C. I haven’t got round to replacing it yet so can’t confirm it’s the sensor for sure.

I get valid values when checking Paper UI (i use it for power consumption), so I think it’s only the storing of the data, but I’ll check if all the values are ok…

1 Like