I’m currently trying to rewrite a binding from openhab 1 to openhab2 (siemensHvac).
The new binding implements some auto discovery features to discover the things attach to the bus.
Has I don’t know the structure of the thing in advance, I’m using some API expose by the bridge to scan the thing, the different channel, channel type, channel group and channel state description.
For this, I’ve implemented different interfaces like ChannelTypeProvider, ConfigDescriptionProvider, ThingTypeProvider, DynamicStateDescriptionProvider.
And I’ve also created a DiscoveryResult that I send back to openhab using discoveryService.registerDevice(discoveryResult).
All of this work quite well. My device show in Inbox, and after adding it, I’ve got a correctly formatted thing in PaperUI, with channels organize as group.
My question is more about what happens when I stop / restart openhab ?
When I restart, my thing appears in the thing listing in PaperUI.
But when I try click on thing to view Channel, It seems that I’ve lost many information’s like Group Definitions, Channel Type Information, …
If I understand it correctly, thing are reload on restart from userdata/jsondb/org.eclipse.smarthome.core.thing.Thing.json ?
But this file seems to only contains basic information’s for the things: label, description, but no group information or channel type definitions?
What is the correct way to handle this when you don’t have an XML thing descriptions file in Esh-inf/thing directory?
Do I need to handle so manual persistence myself for this information’s? Or recreate the information’s at each restart?
I try to take a look to the homematic binding that seems to work the same way, but I’m not sure to understand the way this should work. Perhaps I’ve just miss some obvious things.