Items are persisted, which should not be persisted

HI there,
I’m using OH3 with influxDB2 persistence. So without any explicit configuration, nearly all items are persisted => an InfluxDB measurement per items exists in the database.
However, there are some measurements (items) which don’t make sense like “String” values. An example is the current music track on my audio system. There is a measurement for this in the database (which don’t make sense…)

So I created a very very simple influx.persist

Strategies {
    everyMin  : "0 * * * * ?"
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"

    // if no strategy is specified for an item entry below, the default list will be used
    //default = everyChange
}

Items {
    KlimaBadOG_ActualTemperature : strategy = everyChange, restoreOnStartup
}

So with this config I would except, that there is only one measurement in the influxdb for the item KlimaBadOG_ActualTemperature. The items exists and when saving the influx.persist file, there is no error in the openhab.log file (`Loading model ‘influx.persist’ without any errors).
However, the database contains data of other items as well.

Question 1: Does it make sense to be restrictive on the items, which should be persisted to avoid database entries / measurements? Or is the overall strategy: “Let OH do it’s business … don’t worry about the entries?”

At the end of the day I think it’s a good idea to do a group per persistence strategy and assign the needed items to it. The group(s) are used in the Items section of the persistence configuration.

Question 2 (side question): I’m using the semantic model. Is it possible to define which items should be persisted based on the semantic class, property, type or based on a tag / metadata ?

To clarify: this data is still being updated, or is it the old data from before the persist file was created?

Hi @hafniumzinc,
so after I altered the influx.persist file, I purge the full database (influx delete ...)
In the Influx Web UI there are no measurements (items) after I issued the command. But after some time the measurements are added again (when an item changes)

Have you restarted the persistence service (or openHAB)? New xxx.persist files never used to take effect until next restart.

Of course - it’s just consuming resource otherwise.

Are you sure? When changing the file content, the file gets loaded by openhab.
This behavior is not documented (at least I could not find it).
Anyway: I followed your advise and restarted openhab (service openhab restart) and deleted the database content before this. However all items are created in the DB after the restart…

Yes, it was consistent OH2 behaviour. I have read it might be more dynamic in OH3 - all services, additions, removals? I dunno. But it’s not working for you so worth a try, no?

Okay, so it might have parsed your file but it is not applying it.

Bit slow spotting this … as per docs

All item- and event-related configuration is defined in the file persistence/influxdb.persist

@rossko57 spotted the main problem with the filename.

Q1: As almost always, it depends. If you always want to be able to generate charts for any chartable other at any time, then you’ll want to save everything. rrd4j is great for this since the database size never grows. If you always want your Items to be non-NULL (which isn’t really feasible but you can get close) you’ll want to save all your items with restoreOnStartup. MapDB is a good choice for this.

But if you are using an external database like InfluxDB, it’s usually because you have something outside of OH consuming the data (e.g. Graphana) then it depends on what that external thing is and what you need from it.

Q2: No, not yet anyway.

1 Like

I’ve scrolled trough this post and want to add a pointer.
If you are not sure the model is used you can open up the openhab logs using openhablogtail command.
this should something like this :

`2023-02-28 20:59:55.641 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'influxdb.persist'