I am new at openhab and I am implementing a control interface for a custom irrigation system.
In openHAB 1.x the way to go was to implement a custom ItemProvider and register it as an OSGi service in parallel to the default GenericItemProvider.
As I saw the new Things and Discovery concept in eclipse smarthome project, I switched to openHAB2. There I found the ManagedItemProvider. In the description of the provider I found this:
“ManagedItemProvider is an OSGi service, that allows to add or remove items at runtime by calling ManagedItemProvider#addItem(Item) or ManagedItemProvider#removeItem(Item) .”
But now I dont know how to add items at runtime in my custom binding java code with the ManagedItemProvider.
Am I already on the right way?
As a first remark: Please address such questions about the APIs and architecture directly at the ESH forum, as this is nothing specific to openHAB.
Secondly, bindings must not add items themselves. They instead can implement a discovery service, which will create Things. It is then up to the user to create and link items to the channels of these Things.