Binding Dev: Persist binding data

I’m developing a binding and want to provide access of device property information and make this accessible to a OH rule or a HABpanel widget. This is kind of “one-time setup” information, so not really static, but also not dynamic, which means adding multiple channels to populate this information is an overkill.

I see the following options

  • Thing properties - that would be preferred, however I couldn’t find a way to make thing properties accessible to a OH rule (which really makes sense from my point of view). E.g. a geo location is more or less static. Adding this as a thing property provides enogh flexibility, creating 2 channels for this information is overhead and confuses the user.

  • Property files in userdata - Of course I could write this information to local property files, but this doesn’t feel very smooth if OH provides already a much stronger feature: persistence

  • Persistence: Is it possible to access e.g. mapdb service to store data in the database? OH already supports assigning items to a specific persistence service, so the rule side is already there.

Any other idea?

Then why do you want to show it on Habpanel? HABPanel is your User’s interface not adminstration interface. If it is something that users will care about, then you should create channels. If not I would see if there is a way to present the information in the binding config widget in PaperUI. If it is information that the admin needs to provide when setting up the things then they should be properties on the Thing or perhaps captured in a Thing bridge (e.g zwave serial controller).

There is a system wide location property now and if you look at bindings like Astro the geolication is a Thing property. But Thing properties are not accessible to rules. If you want to make something available to rules it needs to be:

  • linked to an item meaning there is a channel
  • it’s an event channel which means you can use the channel to directly trigger a rule
  • or you can get them online/offline status of the Thing

That’s it Anything else will require buy in from the ESH developers and changes to the core.

You only need one channel that populates a Location Item.

Persistence is for Items only. Binding configs, Things properties, etc do not have access to persistence. There is some stuff stored in the jsondb but that isn’t persistence. Configs are stored as config files under userdata/config which is also not persistence.

If you want it available to the user in rules and for display then it had to be a channel linked to an Item. Items are the functional view of the OH architecture. If it is important enough to be used in a rule it displayed to the user, it deserves a Channel.