Error while dimming with JS Script "Failed to open rrd4j database to store data"

Hey there!
I have a script to dim a dimmer up/down as long I push a button down. The problem is, that sometimes the dimming is interrupted. Can someone help me to get a workaround?

Here is the log entry:

[WARN ] [rd4j.internal.RRD4jPersistenceService] - Failed to open rrd4j database 'WohnzimmerGruppeHelligkeit' to store data (java.lang.IllegalStateException: request interrupted for file:///var/lib/openhab/persistence/rrd4j/WohnzimmerGruppeHelligkeit.rrd)

The item is part of some groups, so the log is filled with similar errors but different items (the dimmer item, two parent groups of the dimmer item).

I think, while the persistance keeps track of the first few dimming steps, it locks the database. So some of the dim commands cannot be implemented.
Here comes the corresponding part of my script:

...
storage.dimTimer = actions.ScriptExecution.createTimer(storage.dimTimerId, time.ZonedDateTime.now(), dimFunction);
...
  if (btnItem.state.toString() == "OFF"){
    console.log('Button OFF, dimming ended.');
    storage.dimTimer.cancel();
    return
  }
...
  // Dimming step
  if (storage.dimUp == true){
    dimItem.sendCommand(INCREASE);
  } else {
    dimItem.sendCommand(DECREASE);
  }
  
  // reschedule dimmer to loop
  let now = time.ZonedDateTime.now();
  storage.dimTimer.reschedule(now.plusSeconds(1));

Background:
The Idea is to use multiple push patterns on a single button to

  • toggle light on/off (single press)
  • switch between different scenes (double press)
  • dim light up/down (as long as the button is pressed down)

Platform information:

  • Hardware: CPUArchitecture/RAM/storage RPI4 x64 8GB
  • OS: Ubuntu 20.04.5 LTS
  • Java Runtime Environment: openjdk 11.0.17 2022-10-18 OpenJDK Runtime Environment (build 11.0.17+8-post-Ubuntu-1ubuntu220.04)
  • openHAB version: 3.4.2

Are you using the default rrd4j strategy. I’ve seen errors like this before when the events happen too fast for them to be written to disk. I was able to eliminate them by avoiding the use of everyUpdate, though there might be a need to eliminate some Items from persistence entirely or configure them to only save every minute.

1 Like