[tradfri] Fix NPE if gateway is unreachable (#9629)
Fixes #9628 Signed-off-by: Stefan Triller <github@stefantriller.de>
This commit is contained in:
parent
d3ae64140f
commit
572da80fd9
|
@ -66,6 +66,10 @@ public abstract class TradfriThingHandler extends BaseThingHandler implements Co
|
|||
this.id = getConfigAs(TradfriDeviceConfig.class).id;
|
||||
TradfriGatewayHandler handler = (TradfriGatewayHandler) tradfriGateway.getHandler();
|
||||
|
||||
active = true;
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
switch (tradfriGateway.getStatus()) {
|
||||
case ONLINE:
|
||||
String uriString = handler.getGatewayURI() + "/" + id;
|
||||
try {
|
||||
URI uri = new URI(uriString);
|
||||
|
@ -76,10 +80,7 @@ public abstract class TradfriThingHandler extends BaseThingHandler implements Co
|
|||
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage());
|
||||
return;
|
||||
}
|
||||
active = true;
|
||||
updateStatus(ThingStatus.UNKNOWN);
|
||||
switch (tradfriGateway.getStatus()) {
|
||||
case ONLINE:
|
||||
|
||||
scheduler.schedule(() -> {
|
||||
observeRelation = coapClient.startObserve(this);
|
||||
}, 3, TimeUnit.SECONDS);
|
||||
|
|
Loading…
Reference in New Issue