[SOLVED] Using multiple persistence services

Hi, I am using multiple persitance services and wanted to know if I am using them correctly in rules

The persistance services I have set up:

  • influxdb… for Grafana charts
  • mapdb… for restore on startup of important switches
  • rrd4j… for computing average values of some items eg pressure sensor

In PaperUI System>Persistance default service I have mapdb set.

They all seem to be working except for an error in a rule where I have specified the service to use. I did it like this


Visual Studio code shows an error:

Ambiguous feature call.
The extension methods
postUpdate(Item, State) in BusEvent and
postUpdate(Item, Number) in BusEvent
both match.

Is the above line of code the correct way to specify the persistance service to be used?

Also, the default service is set to be mapdb. In what situations is this setting used? It seems I needed it for mapdb and rrd4j in order for one of them to work. The one not set there then has to be specified in the code as above. Influx seems quite happy without being specified anywhere.

Thanks Mark.

I would set it to influx or rrd4j, not that it matters very much but mapdb is VERY limited as it only stores the last value.

It’s a warning from VS code telling you that there are several ways to call that method.
You can try to “force” it by doing:

AveragePressureChange.postUpdate(PressureChange.averageSince(now.minusMinutes(30),"rrd4j") as Number)

Thanks for the fast responce.

That indeed fixed it. The OCD voice in my head is now satisfied.:slight_smile:

I mainly use influx and it seems to work without being set as default.

Good, please mark the thread as solved. Thanks

Hey Guys,

i figured this thread might be the most fitting for my question, even though its a couple of years old now.
I started using multiple persistence services because i noticed that some values are not getting properly restored on startup.
So now i’m using rrd4j for charts and mapdb for reboot recovery.
Like m4rk i set the default persistence to mapdb but now the charts are not working. how do i need to set up multiple persistence services as so i get the charts through rrd4j and also get the restore of items on startup with mapdb, is there some textual file i need to change?

Running openhab 3.3.0 release on linux.
thank you :slight_smile:

That’s why.
The “default” service setting is used by OH3s built-in charting to determine which persistence to fetch data from.

At the time of the original post there was no OH3

Yes, each service is individually controlled by a xxx.persist text file.
Including restore-on-startup, which is easy to nisconfigure for several services to fight over restore.

In OH3, the absence of a particular xxx.persist steering file invokes a default “everything” behaviour for that service.

I’d expect your defaults to have MapDB persisting everything, and restoring it. And rrd4j to be persisting everything numeric and switches, and also restoring it.

Ah okay, i think i got it now.
I do have both files, so one mapdb.persist, one rrd4j.persist
i changed the rrd4j.persist to not have any “RestoreOnStartup” values in it, the mapdb-file has them.
that should mean now if i change my default persistence in oh3 to rrd4j the charts will start to work again and mapdb will only make sure values are restored on startup?