Hello,
hopefully I am in the correct subsection here.
I’m currently developing a binding for Nedap PowerRouters (https://mypowerrouter.com).
The idea is to make the binding configurable and after the user has entered the credentials
things shall be added.
So far the handlerfactory looks like this
@Component(service = ThingHandlerFactory.class, immediate = true, configurationPid = "binding.nedappowerrouter")
public class NedapPowerRouterHandlerFactory extends BaseThingHandlerFactory {
...
@Override
protected void activate(ComponentContext componentContext) {
super.activate(componentContext);
Dictionary<String, Object> properties = componentContext.getProperties();
String user = (String) properties.get("username");
String pass = (String) properties.get("password");
routerClient.setUsername(user);
routerClient.setPassword(pass);
if (user == null || user.isEmpty() || pass == null || pass.isEmpty()) {
logger.warn("Username / Password needs to be configured!");
return;
}
logger.debug("Binding credentials updated with {} / {}", user, pass);
try {
routerClient.login();
logger.debug("Login to mypowerrouter.com was {} ", routerClient.isUserLoggedIn());
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
...
My question is how do I add things manually?
I don’t want to add them prior to entering the credentials since the amount of things depends on the
router someone has.
I know about the discovery service and tried it but restarting a scan by code seems not possible…
Thanks in advance