RRD4J set-up / request question

Good morning,
I moved OH2.5 to OH3 and everything is working fine except RR4DJ.

What I did so far:
Install via Main UI RRD4J

Generate rrdj4.persist file within persistence folder with following entries:
Strategies {
everyMinute : “0 * * * * ?”*
default = everyChange*
Items {
WetterstationGarten_Illumination : strategy = everyChange, everyMinute, restoreOnStartup*

afterwards I defined an ECMA script:

var logger = Java.type(‘org.slf4j.LoggerFactory’).getLogger(‘org.openhab.rule.’ + ctx.ruleUID);
var ZonedDateTime = Java.type(‘java.time.ZonedDateTime’);
var PersistenceExtensions = Java.type(‘org.openhab.core.persistence.extensions.PersistenceExtensions’);
var v_schwellwert_verschattung_lux_avg_max = 6000.0;
var v_aktuelle_helligkeit = itemRegistry.getItem(“WetterstationGarten_Illumination”).getState();
var v_helligkeit_avg = PersistenceExtensions.averageSince(
logger.info('Helligkeit = ’ + v_aktuelle_helligkeit + " - AVG: " + v_helligkeit_avg);

When I’m running the script the following log entry is shown:

[rg.openhab.rule.VerschattungUndSturm] - Helligkeit = 6077.00 - AVG: undefined

Any tip or idea how to set-up / fix it?
Thank you very much in advance

Please use code fences.

code fences

Use the REST API Docs (under Developer Tools) to query the database for that Item and verify there is data present and there is an entry every minute.

Have you restarted OH since modifying/creating the .persist file? Some files need a restart, I don’t know if .persist is one of them. Do you see the .persist file being loaded in the logs?

This line looks like it’s missing a closing paren but it’s really hard to read without code fences.

Sorry, didn’t know code fences.
Thank you very much for the information.

Here is the code:

var logger = Java.type('org.slf4j.LoggerFactory').getLogger('org.openhab.rule.' + ctx.ruleUID);
var ZonedDateTime = Java.type('java.time.ZonedDateTime');
var PersistenceExtensions = Java.type('org.openhab.core.persistence.extensions.PersistenceExtensions');

var v_schwellwert_verschattung_lux_avg_max = 6000.0;
var v_aktuelle_helligkeit = itemRegistry.getItem("WetterstationGarten_Illumination").getState();

var v_helligkeit_avg = PersistenceExtensions.averageSince(

logger.info('AVG Helligkeit = ' + v_aktuelle_helligkeit + " - AVG: " + v_helligkeit_avg);

And regarding REST API under Dev Tools - see screenshot. Seems that persistence ist not working, right?
Thank you very much and best regards

Not necessarily. Query for your specific Item’s data. The third in the list under Persistence.

If rrd4j is not configured as the default persistence, make sure to supply “rrd4j” as the service ID in the form.

Note, averageSince returns a Number. A Number doesn’t have a .state.

Hey Rich, you made my day :+1: :wave:

Found with you hints the error now.
First I requested successfully via REST API the persistence values - see screenshot.

But the values are all the same and didn’t changed.

Checked the Homematic Chanel set-up and changed profile from follow to standard. That was the error.


I am receiving now:

[rg.openhab.rule.VerschattungUndSturm] - Helligkeit = 0.00 - AVG: 3121.775593296416

Thank you very much for your information. I’ve learned a lot.
Best regards