How to add things dynamically in the binding [message #1770375] |
Thu, 10 August 2017 09:26  |
Eclipse User |
|
|
|
Hello,
we are currently developing a binding for ESH and are wondering how to add things to the web-ui.
We have a configurationfile were all of our devices and their properties are defined. Our first thought was to parse this file into a .things-file. But the problem here was to get the correct path to store the file for the different platforms...
Now we want to add the things directly. We want to avoid the inbox and need to connect every thing with our bridge.
We already tried the DiscoveryService but this only adds the thing to the inbox without the connection to our bridge.
Could anyone help us with either one of the ways? Or just point us to the right documents?
Regards
Markus
|
|
|
Re: How to add things dynamically in the binding [message #1770423 is a reply to message #1770375] |
Fri, 11 August 2017 03:24   |
Eclipse User |
|
|
|
Hi Markus,
To answer you correctly, I will have to understand your use case a bit better.
Note that a binding is not allowed to decide on its own that certain devices should be used by the installation - this is intentionally left to the user/admin of the system by means of the Inbox.
If you are not implementing a binding, but rather want to build a custom ESH-based runtime that out-of-the-box supports your devices, you can implement your own ThingProvider. This implementation can read your custom config files and dynamically create Things from it. Note that a binding must not implement this interface, so for such a solution you would build a proprietary extension.
A middle path could be to implement a binding with a DiscoveryService, which puts the stuff in the inbox and then use an auto-approve feature (currently only available in openHAB, see https://github.com/openhab/openhab-distro/blob/master/distributions/openhab/src/main/resources/conf/services/runtime.cfg#L51-L54, but I plan to move that to ESH).
Hope this helps,
Kai
|
|
|
|
Re: How to add things dynamically in the binding [message #1770721 is a reply to message #1770425] |
Wed, 16 August 2017 09:09  |
Eclipse User |
|
|
|
> Afterwards the user also have to set the bridge for every thing. This can be really annoying...
> The auto-approve feature could be used, but the required bridge still has to be set by hand?
Not sure why the user has to set the bridge by hand - if you have implemented a discovery service, you can use DiscoveryResultBuilder.withBridge(ThingUID bridgeUID) to set the correct bridge for the inbox entry - and yet, if the auto-approve is used, this will directly result in a Thing and there would be no need for any kind of manual action for the users.
> I don´t know if it is possible to add OpenHab-Bindings to an extension only based on ESH?
Do you mean "to a solution only based on ESH"? Well, almost everything in openhab2-addons merely uses the ESH APIs and have no dependency on openHAB-specific code - so yes, in general that is possible with a few exceptions.
|
|
|
Powered by
FUDForum. Page generated in 0.02583 seconds