|
Re: How to add things dynamically in the binding [message #1770423 is a reply to message #1770375] |
Fri, 11 August 2017 07:24 |
Kai Kreuzer Messages: 673 Registered: December 2011 |
Senior Member |
|
|
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 #1770425 is a reply to message #1770423] |
Fri, 11 August 2017 08:32 |
markus petke Messages: 6 Registered: August 2017 |
Junior Member |
|
|
Hello Kai,
thanks for the fast reply.
We are really new to ESH and OpenHAB. So at the beginning we just wanted to develope a binding. We can already create things from PaperUi and use their channels and so on.
The problem is that in our case we can have many devices/things and we wanted to automatically add them to the interface. All of these devices are defined in an configuration-file. Parsing this file into a .things-file is really easy and we have already done that. With this method the things are added directly with the right configuration and the required bridge.
After testing, we encountered the problem that we couldn´t get the correct path to store the file. One possibility would be to let the user define the path per property of the bridge but we wanted to avoid the user from to much configuration. So he should just give us the configurationfile and everything else should happen automatically.
After that we tried the DiscoveryService. That also worked with a concrete path to the configfile but we could not see any possibility to let the user decide were to look for the file. Furthermore all of the things are at the inbox and have to be confirmed by hand. That is not a problem for 2 or 3 devices but in our case there are up to a few hundred things. Afterwards the user also have to set the bridge for every thing. This can be really annoying...
So to understand your answer. The auto-approve feature could be used, but the required bridge still has to be set by hand?
Developing a complete new extension would be the prefered way but we also want the users to have the ability to add several bindings also for openhab by their own. I don´t know if it is possible to add OpenHab-Bindings to an extension only based on ESH?
Regards
Markus
[Updated on: Fri, 11 August 2017 08:45] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03153 seconds