Discovery service configuration

Hi guys,

This is more of a developer question.

Does anyone know if there is a way to have a discovery service configured ? I’m creating a new binding to query my cable provider and discover the “devices”, but I need to specify user/password to query their web service.

Any ideas ?

There is the onActivate method but where would the config be ?

Im having the same issue. Im accessing an API, so username and password required. Did you ever find the solution?

Sort of, I actually made a bridge thing that would do the scanning when it starts then I linked my “terminals” to this bridge to be able to send queries to their API.

ah, I did look at this, but I seem to have the same sort of question then. How do you pass the bridge into the discovery service?

I have played around with this, added a bridge (which works) but now my discovery service doesnt start. Anything you can do to point me in the right direction is much appreciated.


public MyDiscoveryService(MyBridgeHandler myHomeBridgeHandler) {
    super(myBindingConstants.SUPPORTED_THING_TYPES_UIDS, DISCOVER_TIMEOUT_SECONDS);"Starting the  Discovery Service");
    this.bridgeHandler = myiHomeBridgeHandler;

so how do you pass in the handler?

What you need to do is to dynamically register the discovery service instead of an automatic register from the xml file definition when your bridge starts. Then you can construct the discovery however you want and pass the creds along to the service itself from the bridge.

Then when the bridge gets shutdown/deactivated, you unregister the service to the OSGi platform.

There is at least one binding that acts that way already (I don’t recall if it’s in the smarthome or openhab2 addons repo), but if you look for the discovery interface, you will eventually find a dynamic registration in a thing/bridge object.

I can send you the piece of code to do that later today.

Sorry for my slow reply. Many thanks for that, I will take a look, but any code much appreciated