Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Eclipse SmartHome » How to get binding configuration properties in an AbstractDiscoveryService?
How to get binding configuration properties in an AbstractDiscoveryService? [message #1751712] Thu, 12 January 2017 18:49 Go to next message
Michael Kolb is currently offline Michael KolbFriend
Messages: 1
Registered: January 2017
Junior Member
Hey guys,

I created a binding which requires a mandatory configuration parameter which contains the url of a server:

binding.xml
<config-description>
		<parameter name="server" type="text" required="true">
			<label>server url</label>
			<description>Required Property, always set this one</description>
		</parameter>
</config-description>



To get the parameter value, I'am using

MyHandlerFactory.java
@Override
    protected void activate(ComponentContext componentContext) {
        super.activate(componentContext);
        Dictionary<String, Object> properties = componentContext.getProperties();
        String server = (String) properties.get("server");


in my BaseThingHandlerFactory, which works quite well. Unfortunately my AbstractDiscoveryService's activate method is not called again, as it is in the BaseThingHandlerFactory, when setting the property in paperUI.

I have to know the property value in my discovery service, as without the server URL discovery is not possible at all.


So how to get this property's value in a AbstractDiscoveryService?

Best Regards,
-mk
Re: How to get binding configuration properties in an AbstractDiscoveryService? [message #1751857 is a reply to message #1751712] Mon, 16 January 2017 10:17 Go to previous message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 673
Registered: December 2011
Senior Member
How did you register your discovery service? You will need to register it through code within your ThingHandlerFactory - i.e. register it in activate() and unregister it in deactivate() of your handler factory (similar to this: https://github.com/eclipse/smarthome/blob/master/extensions/binding/org.eclipse.smarthome.binding.hue/src/main/java/org/eclipse/smarthome/binding/hue/internal/HueThingHandlerFactory.java#L99-L102). Through this, you always have the chance to pass your current configuration to it.
Previous Topic:Yahoo Weather Binding Crash
Next Topic:How To Query Items Things and Bindings
Goto Forum:
  


Current Time: Thu May 02 12:18:15 GMT 2024

Powered by FUDForum. Page generated in 0.03372 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top