Getting the list of current items in persistence service configuration screen

Hi there,

I’m developing a persistence service and I’d like to be able to display on service’s UI configuration page the list of currently registered items and let the user select which ones to persist. So far I have in the addon.xml definition of the parameter:

<parameter name="currentlyRegisteredItems" type="text" multiple="true">
	<label>Items</label>
	<options>
	</options>
</parameter>

I also implemented ConfigOptionProvider, but it looks like it is never activateд as OSGI component and its getParameterOptions is never invoked.

Any advise?

Thank you!

Why do you want to do that? What gets persisted is defined with the persistence strategy. That’s where you would define the items, not with the persistence service. That’s also where it would show what gets persisted.
See: Persistence | openHAB
This can be configured through files or the UI.

Well, this is generic UX. I don’t want to force the users to learn another configuration file format, know about directory structure, copy/paste item names from the UI to the configuration file, etc. This kind of defies the purpose of having UI.

I don’t agree. I am fairly sure a persistence service with a specific configuration UI to select items will not be accepted. I also don’t think you can easily make it work. The UI to configure persistence is the same for all persistence services and is easy to find in OH 4.2 (there have been improvements to this since 4.1). You should not try to create something specific and different from other persistence services as that will only create more confusion. In my view, the current UI is pretty easy and covers all that is needed.

1 Like

This becomes kind of conceptual discussion, and I’m too new to offer any strong opinion, but anyway: :slight_smile:

The UI to configure persistence is the same for all persistence services

Not really. For each add-on (persistence service or whatever) you have the possibility to define service-specific configuration parameters through addon.xml, and those properties to be displayed in the service’s configuration screen. The only common persistence configuration is the ability to define default service, which looks like not available in 4.2.0.M4.

You should not try to create something specific and different from other persistence services as that will only create more confusion

I don’t. As you wrote yourself you have a configuration file where you can specify the list of items to be persisted. Why not have in the UI?

It already is also in the UI and you don’t have to do anything for it in the persistence addon itself.

Configuration page, click on Persistence:

Select one of the installed persistence services to configure the policy:

Top of my configuration page for InfluxDB, listing the items being persisted and the strategy for each item (or group of items). Other configuration options are lower down on the page:

All of what is available in the file configuration is also available in the UI. It is true a persistence service can have other configuration options, things like a connection string to connect to a DB would be a good example. That is to configure the connection to your DB, not to configure what gets stored in the DB. That’s what the persistence configuration is for.

OK, I installed 4.2 and finally saw it. Thanks!