How to define rrd4j new defnames in openhab.cfg and use them in openhab 1.8

rrd4j
Tags: #<Tag:0x00007f212f684640>

(Stefanbode) #1

I have the following problem with contact and motion sensors. The default RRD4J is using the AVERAGE function on aggregation in h, D, W, M and so on. This is not useful if I also want to detect on a long term, when a window was opened, even a short time. My aggregation must be MAX for example for the doors/windows. How can I override for the Group WindowsAndDoors the calculation method? The next lines are for sure wrong, but something similar I’m expecting:

rrd4j:ctr5min.def=COUNTER,900,0,U,300
rrd4j:ctr5min.archives=MAX,0.5,1,365:MAX,0.5,7,300
rrd4j:ctr5min.items=WindowsAndDoors


(Jürgen Baginski) #2

You would need to delete the old database and then rewrite the file you posted with the settings you need.
Are you really using only 365 minute values in the first archive and 300 values of the 7 minutes steps of the second archive. That would be 6 houres 5 minutes for the first and 35 houres for the second archive!!


(Stefanbode) #3

Thank’s Jürgen,
I now got it running and learned a lot (again).

  1. Yes, you have to delete the old file. it will not work as long as the old file is there
  2. xxx.items must have ALL items that you want to change. You cannot use a group or something else or wildcards. May a long list, manually updated.
  3. the format of the archive is now clear: MAX, MIN is great, if you want to focus on open windows and doors and motion. Status did not get lost by the normal Average function. 0.5 is a calculation standard. No need to change this. The third parameter is the minimum duration or called window where ONE value is stored: 1=1 second, 60= 1 value per minute. The fourth parameter is a bit tricky. It is the number of buckets in this archive and bucket x duration = maximum period of measuring in this granularity. 7 x 300 = 2100 seconds =35 min in 7 second granularity. Normally you calculate it the other way around: e.g 1 day = 60x60x24 = 86400 seconds, required resolution e.g. 2 seconds ==> buckets to generate = 86400 / 2.

(Jürgen Baginski) #4

Are you sure about the second, as far as I understand the standard is 1 minute. At least it is working like that for me.

[Edit:]
looking at bit closer I see, you changed the standard “step” from 60 seconds (as I assumed) to 300 seconds! So your archives are covering:
Archive 1 Stepsize 300 secs Steps 1 Rows 365 (3001365)=109500 seconds i.e. 30.4 houres with a granularity of 5 minutes (300 seconds)
Archive 2 Stepsize 300 secs Steps 7 Rows 300 (3007300)=630000 seconds i.e. 175 houres with a granularity of 35 minutes (300*7 seconds)


(Stefanbode) #5

Yes agree. My new def is:

rrd4j:ctr5min.def=GAUGE,90,U,U,1

and this is one second and then my post above make sense.


(Jürgen Baginski) #6

…so I’m not the only one who does NOT use the default settings of rrd4j. :slight_smile::+1::+1::+1:


(Stefanbode) #7

Do you know an external tool to view the rrd files from openhab 1.8? As far as I know there is no or no good way to customize the graphs openhab is using.


(Jürgen Baginski) #8

Short answer NO.
When asking for a better way to display you are bound the get this suggestion.
I tried it, looks good, however I do stick to rrd4j because of it takes less ressources of my raspi.
Using Habpanel to show the graph you can use n3-line charts, preconfigured as the chart on classicUI, however looking great (to me).
For displaying single datapoints you can use the REST API., but that would be only a numeric display no chart.