Development documentation

Where do i find general documentation for binding development? The ones i have found is great to get started to get everything up and compiling, and even further to get my binding to start up and actually do something.
What im lacking is more an overall description of whats available, what/when to use something and so on.
Questions like, is my stuff a binding or a thing, whats needed to get discovery up and running, how do i declare things and channels. And so on. Pretty basic stuff really that gets a bit lost when im only checking other peoples code.

/C

Hi Christer,

The documentation is at https://www.eclipse.org/smarthome/documentation/development/bindings/how-to.html.
It is far from being exhaustive and complete, but contributions to it are always welcome, once you feel that you have understood something and would want to share this with others :slightly_smiling:
The place to discuss open questions about architecture etc. is the ESH forum.

Regards,
Kai

Hi

Awesome! it looks like its exactly what i was looking for =) Thanks.
It’ll be a while before i can contribute to anything, i dropped java for c# 15 years ago so i am, to say the least, a bit rusty.

/C

I created a new topic: Documentation for development of IO Bindings

Of course i saw this topic, but there is still no link for an IO-binding documantation :slight_smile:

In lack of a better place to ask.

I have now managed to get my binding up and running and swapped things around a bit to be more on par with the suggested way of doing things.
And i implemented a discoveryservice, at first i peeked at the MAX! binding and registered in the HandlerFactory, but then i moved it to my bridge instead so the bridge registers the discoveryservice.
Also i added som configuration since i need username and password for everything to work.

Now im in a state where i dont have any things (Supported thing types is empty in paper ui) and if i try to add a thing manually i can see the message “Binding does not support discovery” so clearly something is way of here =)
The binding works (or atleast did) if i specify a thing in the thing file and add configuration to it there.

My plan was to add the discovery service and automatically register my bridge. the bridge then has configuration (defined in thing-types.xml under my in ), and until it has configuration it does nothing. When it has configuration i can then log on to a remote server and get my things from there.
I cant see any errors or warnings in the log.

Its for online monitoring of a heat pump (thermia), so one account can access multiple installations so my bridge is just the account, and my things are each installation (heatpump).

So my questions,
What could i have messed up if no supported thing types are listed? i thought that was the xml?
What have i missed when registering the discoveryservice?
Is my plan reasonable or is there a better approach?

Simplified code for my discoveryservice, all typechecks and logging removed. i have verified that everything runs and get registered.

from my HandlerFactory
protected ThingHandler createHandler(Thing thing) {
return new ThermiaOnlineHandler((Bridge) thing, network);
}

public class ThermiaOnlineHandler extends BaseBridgeHandler {
private ServiceRegistration discoveryRegistration;
private ThermiaOnlineDiscoveryService discoveryService;

public ThermiaOnlineHandler(Bridge bridge, NetworkHandler networkHandler) {
    super(bridge);
    this.network = networkHandler;
}

@Override
public void initialize() {
    discoveryService = new ThermiaOnlineDiscoveryService(this, network);
    discoveryRegistration = bundleContext.registerService(DiscoveryService.class.getName(), discoveryService,
            new Hashtable<String, Object>());

    updateStatus(ThingStatus.ONLINE);
}

…
}

public class ThermiaOnlineDiscoveryService extends AbstractDiscoveryService {

public ThermiaOnlineDiscoveryService(ThermiaOnlineHandler bridge, NetworkHandler network) {
    super(ThermiaOnlineBinding.SupportedThingTypes, 10, false);
    this.bridge = bridge;
    this.network = network;
    DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(bridge.getThing().getUID())
            .withLabel("Thermia online bridge").build();
    thingDiscovered(discoveryResult);
}

@Override
protected void startScan() {
     //Load remote data.. this is never called. 
}

…
}

I think i solved this one myself. I figured i had to register the discoveryservice wich solved that part. And also i had managed to squeeze an extra character into the bindingname causing everything to go tits up.

/C