Limit to single instance of a Thing in binding [message #1744616] |
Wed, 28 September 2016 22:53  |
Eclipse User |
|
|
|
Would like suggestions on where and how to implement this. I have a bridge (B) which can only have a single instance of a particular thing type (T). I was looking at overriding the createThing function to make sure B does not already have a T instantiated.
The createThing function gets passed a BridgeUID to the function, but how do I get the Bridge Thing in order to call getThings() to see if one is already instantiated?
Is there a better/alternative way to accomplish this?
Thanks,
Jeff
|
|
|
Re: Limit to single instance of a Thing in binding [message #1744800 is a reply to message #1744616] |
Fri, 30 September 2016 09:58   |
Eclipse User |
|
|
|
What exactly is it that you want to prevent/achieve?
You e.g. cannot prevent that users define any number of Things of the same type in a *.things file and associate them to your bridge. So you will have to deal with this in your handler implementations when they are initialized. Within the handler, you have access to the bridge handler, so you can report a configuration error and not put the Thing to ONLINE.
Regards,
Kai
|
|
|
Re: Limit to single instance of a Thing in binding [message #1744842 is a reply to message #1744800] |
Fri, 30 September 2016 17:05  |
Eclipse User |
|
|
|
Hi Kai - Thanks for the response.
I'm writing a binding to interface with Pentair pool equipment. There should only be a single controller on their control bus and since I'm not testing the binding in the case someone creates 2 controller things, the results are not predictable. So, I'd rather just prevent that configuration from being setup by someone.
Jeff
|
|
|
Powered by
FUDForum. Page generated in 0.03158 seconds