High, I’m trying to work on the Tankerkoening binding (from @dolic).
I did run into a problem which I can’t understand.
I have several config setting in the “TankerkoenigBindingConstants.java” like:
public final static String CONFIG_API_KEY = "apikey"; public final static String CONFIG_SETUP_MODE = "setupmode"; public final static String CONFIG_USE_OPENINGTIME = "use_OpeningTime";
They are used in the “BrigeHandler.java” with no problem.
Using them in the “TankerkoenigHandler.java” raises a NPE, especially the “CONFIG_SETUP_MODE” in the last line shown here:
public void initialize() {
logger.debug(“Initializing Tankerkoenig handler ‘{}’”, getThing().getUID());
Configuration config = getThing().getConfiguration();
this.setLocationID((String) config.get(TankerkoenigBindingConstants.CONFIG_LOCATION_ID)); this.setApiKey((String) config.get(TankerkoenigBindingConstants.CONFIG_API_KEY)); this.setSetupMode((boolean) config.get(TankerkoenigBindingConstants.CONFIG_SETUP_MODE));
The errors:
2017-03-03 11:38:59.509 [DEBUG] [.t.handler.TankerkoenigHandler:67 ] - Initializing Tankerkoenig handler 'tankerkoenig:tankstelle:c0a85638’
2017-03-03 11:38:59.530 [INFO ] [ome.event.ThingStatusInfoEvent:43 ] - ‘tankerkoenig:tankstelle:c0a85638’ updated: INITIALIZING
2017-03-03 11:38:59.558 [INFO ] [nt.ThingStatusInfoChangedEvent:43 ] - ‘tankerkoenig:tankstelle:c0a85638’ changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to INITIALIZING
2017-03-03 11:38:59.560 [INFO ] [ome.event.ThingStatusInfoEvent:43 ] - ‘tankerkoenig:tankstelle:c0a85638’ updated: UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
2017-03-03 11:38:59.561 [INFO ] [nt.ThingStatusInfoChangedEvent:43 ] - ‘tankerkoenig:tankstelle:c0a85638’ changed from INITIALIZING to UNINITIALIZED (HANDLER_INITIALIZING_ERROR)
2017-03-03 11:38:59.563 [ERROR] [.c.thing.internal.ThingManager:713 ] - Exception occured while initializing handler of thing ‘tankerkoenig:tankstelle:c0a85638’: java.lang.NullPointerExceptionjava.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask.report(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
The ApiKey isn’t set either, however this one is set to null(or remains null). Am I missing something?
The same lines are working in the BridgeHadler with no problem.