Help needed writing OH2 binding

Hi all

Hopefully this is the right place for this post…

I’m just starting to move my proof of concept code for the Orvibo S20 sockets to an OH2 binding but I’m a bit stumped by a) whether I need a bridge thing b) how to set up the discovery service and activate it. I’ve read the articles on the eclipse smart home page and while the information is helpful it certainly isn’t complete.

Having run the script to create thing binding I turned my attention to the XML files. My first thought was that since each socket is a “thing” and that I can talk to each one directly I don’t need a bridge thing. Is this a sensible design choice?

Moving to the discovery service, I’ve created the class but I’m not sure how to register it as a bundle (is that the right term?) In the framework.

Are there any more comprehensive docs that I can reference?

Thanks

The available documentation is at https://www.eclipse.org/smarthome/documentation/development/bindings/how-to.html.
For questions on how to do certain things, I would like to ask you to refer to the Eclipse forum at https://www.eclipse.org/forums/index.php/f/271/.

Thanks,
Kai

Hi @Kai

I’ve read the documentation which gave me a good start however I feel there are still gaps for people new to OSGi/ESH. I did however manage to overcome my initial problem with discovery service by looking at other bindings but I had a couple of questions which appear fall between the ESH/OH2 separation.

The first was posted over at ESH forum but despite many views no one as yet replied. I was looking for the proper way to change the label of a Thing (displayed in Paper UI). My use case is that the name/alias of an S20 socket can change and I’d like this to be reflected in the UI. Having done some more digging it appears that the label is set up as an Item linked to a Thing, rather than a Channel. Am I understanding this correctly?

I used:

thing.getLinkedItem().setLabel(newLabel) 

Is this the best way to do this?

FTR: I have answered on the Eclipse Forum by now - sorry for taking so long!