Java源码示例:org.eclipse.smarthome.core.thing.ThingStatus

示例1
/**
 * Initialize the bridge.
 */
@Override
public void initialize() {
    logger.debug("Initializing meteoblue bridge");

    MeteoBlueBridgeConfig config = getConfigAs(MeteoBlueBridgeConfig.class);
    String apiKeyTemp = config.getApiKey();
    if (StringUtils.isBlank(apiKeyTemp)) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
                "Cannot initialize meteoblue bridge. No apiKey provided.");
        return;
    }

    apiKey = apiKeyTemp;

    healthCheck();
}
 
示例2
@Override
public void initialize() {
    config = thing.getConfiguration();
    serverPort = Integer.parseInt(config.get(CONFIG_SERVER_PORT).toString());
    pollTimeInSeconds = new BigDecimal(config.get(CONFIG_POLL_CAMERA_MS).toString());
    motionChangesOrder = (boolean) config.get(CONFIG_MOTION_CHANGES_ORDER);
    pollTimeInSeconds = pollTimeInSeconds.divide(new BigDecimal(1000), 1, RoundingMode.HALF_UP);
    if (serverPort == -1) {
        logger.warn("The SERVER_PORT = -1 which disables a lot of features. See readme for more info.");
    } else if (serverPort < 1025) {
        logger.warn("The SERVER_PORT is <= 1024 and may cause permission errors under Linux, try a higher port.");
    }
    if (!"-1".contentEquals(config.get(CONFIG_SERVER_PORT).toString())) {
        startStreamServer(true);
    } else {
        logger.warn("SERVER_PORT is -1 which disables all serving features of the camera group.");
    }
    updateStatus(ThingStatus.ONLINE);
    pollCameraGroupJob = pollCameraGroup.scheduleAtFixedRate(pollingCameraGroup, 10000,
            Integer.parseInt(config.get(CONFIG_POLL_CAMERA_MS).toString()), TimeUnit.MILLISECONDS);
}
 
示例3
private void assertThingStatus(Map<String, Object> propsThing, Map<String, Object> propsChannel, ThingStatus status,
        ThingStatusDetail statusDetail) {
    Configuration configThing = new Configuration(propsThing);
    Configuration configChannel = new Configuration(propsChannel);

    Thing thing = ThingBuilder.create(THING_TYPE_UID, THING_UID).withChannels(Collections.singletonList( //
            ChannelBuilder.create(CHANNEL_UID, "Switch").withType(CHANNEL_TYPE_UID).withConfiguration(configChannel)
                    .build() //
    )).withConfiguration(configThing).build();

    managedThingProvider.add(thing);

    waitForAssert(() -> {
        assertEquals(status, thing.getStatus());
        assertEquals(statusDetail, thing.getStatusInfo().getStatusDetail());
    });

    managedThingProvider.remove(thing.getUID());
}
 
示例4
@Override
public void onUpdate(JsonElement data) {
    logger.debug("onUpdate response: {}", data);

    if (endPoint != null) {
        try {
            JsonArray array = data.getAsJsonArray();
            for (int i = 0; i < array.size(); i++) {
                requestDeviceDetails(array.get(i).getAsString());
            }
        } catch (JsonSyntaxException e) {
            logger.debug("JSON error: {}", e.getMessage());
            setStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR);
        }
    }
}
 
示例5
@Test
public void thingStatusInfoLocalizedForMalformedArguments() {
    setThingStatusInfo(thing, new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "@text/offline.with-two-params   [   \"@text/communication-problems\", ,      \"120\"  ]"));

    ThingStatusInfo thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing,
            null);
    assertThat(thingStatusInfo, is(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "Thing is offline because of communication problems. Pls try again after 120 seconds.")));

    thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, Locale.GERMAN);
    assertThat(thingStatusInfo, is(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "Thing ist wegen Kommunikationsprobleme offline. Bitte versuchen Sie es in 120 Sekunden erneut.")));

    thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, Locale.ENGLISH);
    assertThat(thingStatusInfo, is(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "Thing is offline because of communication problems. Pls try again after 120 seconds.")));
}
 
示例6
@SuppressWarnings("null")
@Override
public void run() {
    initChannelHandlerFatory();
    heosGroup = heos.getGroupState(heosGroup);
    if (!heosGroup.isOnline() || !heosGroup.getGroupMemberHash()
            .equals(thing.getConfiguration().get(GROUP_MEMBER_HASH).toString())) {
        bridge.setThingStatusOffline(thing.getUID());
        setStatusOffline();
        return;
    }
    updateStatus(ThingStatus.ONLINE);
    bridge.setThingStatusOnline(thing.getUID()); // informs the System about the existing group
    HashMap<String, HeosGroup> usedToFillOldGroupMap = new HashMap<>();
    usedToFillOldGroupMap.put(heosGroup.getNameHash(), heosGroup);
    heos.addHeosGroupToOldGroupMap(usedToFillOldGroupMap);
    id = heosGroup.getGid(); // Updates the id of the group. Needed if group leader has changed
    refreshChannels();
}
 
示例7
@Test
public void thingStatusInfoLocalizedForOfflineStatusWithTwoArguments() {
    setThingStatusInfo(thing, new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "@text/offline.with-two-params [\"@text/communication-problems\", \"120\"]"));

    ThingStatusInfo thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing,
            null);
    assertThat(thingStatusInfo, is(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "Thing is offline because of communication problems. Pls try again after 120 seconds.")));

    thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, Locale.GERMAN);
    assertThat(thingStatusInfo, is(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "Thing ist wegen Kommunikationsprobleme offline. Bitte versuchen Sie es in 120 Sekunden erneut.")));

    thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing, Locale.ENGLISH);
    assertThat(thingStatusInfo, is(new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR,
            "Thing is offline because of communication problems. Pls try again after 120 seconds.")));
}
 
示例8
@Override
public void onDutyCycleRatioUpdate(int dutyCycleRatio) {
    synchronized (dutyCycleRatioUpdateLock) {
        this.dutyCycleRatio = dutyCycleRatio;
        Channel dutyCycleRatioChannel = thing.getChannel(CHANNEL_TYPE_DUTY_CYCLE_RATIO);
        if (dutyCycleRatioChannel != null) {
            this.updateState(dutyCycleRatioChannel.getUID(), new DecimalType(dutyCycleRatio));
        }

        if (!isInDutyCycle && dutyCycleRatio >= DUTY_CYCLE_RATIO_LIMIT) {
            logger.info("Duty cycle threshold exceeded by homematic bridge {}, it will go OFFLINE.",
                    thing.getUID());
            isInDutyCycle = true;
            this.updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.DUTY_CYCLE);
        } else if (isInDutyCycle && dutyCycleRatio < DUTY_CYCLE_RATIO_LIMIT) {
            logger.info("Homematic bridge {} fell below duty cycle threshold and will come ONLINE again.",
                    thing.getUID());
            isInDutyCycle = false;
            this.updateStatus(ThingStatus.ONLINE);
        }
    }
}
 
示例9
@Override
public void initialize() {
    logger.debug("Initializing thing {}", getThing().getUID());
    config = getConfigAs(LIRCRemoteConfiguration.class);
    remoteName = config.getRemote();
    if (remoteName == null) {
        logger.error("Remote name is not set in {}", getThing().getUID());
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Remote name is not set");
    } else {
        bridgeHandler = (LIRCBridgeHandler) getBridge().getHandler();
        bridgeHandler.registerMessageListener(this);
        if (getBridge().getStatus() == ThingStatus.ONLINE) {
            updateStatus(ThingStatus.ONLINE);
        } else {
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
        }
    }
}
 
示例10
private void establishConnection() {
    TradfriGatewayConfig configuration = getConfigAs(TradfriGatewayConfig.class);

    this.gatewayURI = "coaps://" + configuration.host + ":" + configuration.port + "/" + DEVICES;
    this.gatewayInfoURI = "coaps://" + configuration.host + ":" + configuration.port + "/" + GATEWAY + "/"
            + GATEWAY_DETAILS;
    try {
        URI uri = new URI(gatewayURI);
        deviceClient = new TradfriCoapClient(uri);
    } catch (URISyntaxException e) {
        logger.error("Illegal gateway URI '{}': {}", gatewayURI, e.getMessage());
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getMessage());
        return;
    }

    DtlsConnectorConfig.Builder builder = new DtlsConnectorConfig.Builder(new InetSocketAddress(0));
    builder.setPskStore(new StaticPskStore(configuration.identity, configuration.preSharedKey.getBytes()));
    dtlsConnector = new DTLSConnector(builder.build(), new InMemoryConnectionStore(100, 60));
    endPoint = new TradfriCoapEndpoint(dtlsConnector, NetworkConfig.getStandard());
    deviceClient.setEndpoint(endPoint);
    updateStatus(ThingStatus.UNKNOWN);

    // schedule a new scan every minute
    scanJob = scheduler.scheduleWithFixedDelay(this::startScan, 0, 1, TimeUnit.MINUTES);
}
 
示例11
/**
 * This method is called whenever the connection to the {@link HueBridge} is resumed.
 *
 * @throws ApiException if the physical device does not support this API call
 * @throws IOException if the physical device could not be reached
 */
private void onConnectionResumed() throws IOException, ApiException {
    logger.debug("Bridge connection resumed. Updating thing status to ONLINE.");

    if (!propertiesInitializedSuccessfully) {
        FullConfig fullConfig = hueBridge.getFullConfig();
        Config config = fullConfig.getConfig();
        if (config != null) {
            Map<String, String> properties = editProperties();
            properties.put(PROPERTY_SERIAL_NUMBER, config.getMACAddress().replaceAll(":", "").toLowerCase());
            properties.put(PROPERTY_FIRMWARE_VERSION, config.getSoftwareVersion());
            updateProperties(properties);
            propertiesInitializedSuccessfully = true;
        }
    }

    updateStatus(ThingStatus.ONLINE);
}
 
示例12
@Override
public void updateFirmware(Firmware firmware, ProgressCallback progressCallback) {
    progressCallback.defineSequence(ProgressStep.DOWNLOADING, ProgressStep.TRANSFERRING, ProgressStep.UPDATING,
            ProgressStep.REBOOTING, ProgressStep.WAITING);

    updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.FIRMWARE_UPDATING, "Firmware is updating");

    progressCallback.next();
    for (int percent = 1; percent < 100; percent++) {
        try {
            Thread.sleep(STEP_DELAY);
        } catch (InterruptedException e) {
            progressCallback.failed("Magic firmware update progress callback interrupted while sleeping", e);
        }
        progressCallback.update(percent);
        if (percent % 20 == 0) {
            progressCallback.next();
        }
    }

    getThing().setProperty(Thing.PROPERTY_FIRMWARE_VERSION, firmware.getVersion());

    progressCallback.success();

    updateStatus(ThingStatus.ONLINE);
}
 
示例13
/**
 * Subscribe on all channel static topics on all {@link ChannelState}s.
 * If subscribing on all channels worked, the thing is put ONLINE, else OFFLINE.
 *
 * @param connection A started broker connection
 */
@Override
protected CompletableFuture<@Nullable Void> start(MqttBrokerConnection connection) {
    List<CompletableFuture<@Nullable Void>> futures = channelStateByChannelUID.values().stream()
            .map(c -> c.start(connection, scheduler, 0)).collect(Collectors.toList());
    return CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()])).thenRun(() -> {
        updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE);
    });
}
 
示例14
/**
 * Manages the adding of the childHandler to the handlerList and sets the Status
 * of the thing to ThingStatus.ONLINE.
 * Add also the player or group channel to the bridge.
 */

@Override
public synchronized void childHandlerInitialized(ThingHandler childHandler, Thing childThing) {
    handlerList.put(childThing.getUID(), childHandler);
    thingOnlineState.put(childThing.getUID(), ThingStatus.ONLINE);
    this.addPlayerChannel(childThing);
    logger.info("Initzialize child handler for: {}.", childThing.getUID().getId());
}
 
示例15
/**
 * Return the bridge status.
 */
public ThingStatusInfo getBridgeStatus() {
    Bridge b = getBridge();
    if (b != null) {
        return b.getStatusInfo();
    } else {
        return new ThingStatusInfo(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE, null);
    }
}
 
示例16
@Override
public void bridgeChangeEvent(String event, String result, String command) {
    if (event.equals(EVENTTYPE_EVENT)) {
        if (command.equals(PLAYERS_CHANGED)) {
            playerDiscovery.scanForNewPlayers();
        } else if (command.equals(GROUPS_CHANGED)) {
            playerDiscovery.scanForNewPlayers();
        } else if (command.equals(CONNECTION_LOST)) {
            updateStatus(ThingStatus.OFFLINE);
            bridgeIsConnected = false;
            logger.warn("Heos Bridge OFFLINE");
        } else if (command.equals(CONNECTION_RESTORED)) {
            connectionDelay = true;
            initialize();
        }
    }
    if (event.equals(EVENTTYPE_SYSTEM)) {
        if (command.equals(SING_IN)) {
            if (result.equals(SUCCESS)) {
                if (!loggedIn) {
                    loggedIn = true;
                    addFavorits();
                    addPlaylists();
                }
            }
        } else if (command.equals(USER_CHANGED)) {
            if (!loggedIn) {
                loggedIn = true;
                addFavorits();
                addPlaylists();
            }
        }
    }
}
 
示例17
/**
 * If a thing is discovered, the method checks if the thing is already known
 * and the state is only temporary set to OFFLINE. If so initialize() of the
 * thing is called.
 */

@Override
public void thingDiscovered(DiscoveryService source, DiscoveryResult result) {
    if (handlerList.containsKey(result.getThingUID())) {
        if (thingOnlineState.containsKey(result.getThingUID())) {
            if (thingOnlineState.get(result.getThingUID()).equals(ThingStatus.OFFLINE)) {
                handlerList.get(result.getThingUID()).initialize();
            }
        }
    }
}
 
示例18
@Test
public void thingStatusInfoNotChangedForNonI18nConstantDescription() {
    ThingStatusInfo expected = new ThingStatusInfo(ThingStatus.ONLINE, ThingStatusDetail.NONE, "The description.");
    setThingStatusInfo(thing, expected);

    ThingStatusInfo thingStatusInfo = thingStatusInfoI18nLocalizationService.getLocalizedThingStatusInfo(thing,
            null);
    assertThat(thingStatusInfo, is(expected));
}
 
示例19
private void determineBridgeStatus() {
    ThingStatus status = ThingStatus.OFFLINE;
    for (Thing thing : getThing().getThings()) {
        if (ThingStatus.ONLINE.equals(thing.getStatus())) {
            status = ThingStatus.ONLINE;
            break;
        }
    }
    updateStatus(status);
}
 
示例20
@Test
public void testIfTheIntervalForAMoonThingIsGreaterThan86400_theThingStatusBecomesOFFLINE() {
    Configuration thingConfiguration = new Configuration();
    thingConfiguration.put(GEOLOCATION_PROPERTY, GEOLOCATION_VALUE);
    thingConfiguration.put(INTERVAL_PROPERTY, new Integer(86401));
    assertThingStatus(thingConfiguration, ThingStatus.OFFLINE);
}
 
示例21
@Test
public void initializeGeneralTimeout() throws InterruptedException {
    // A non completed future is returned for a subscribe call to the attributes
    doReturn(future).when(thingHandler.device.attributes).subscribeAndReceive(any(), any(), anyString(), any(),
            anyInt());
    doReturn(future).when(thingHandler.device.attributes).unsubscribe();

    // Prevent a call to accept, that would update our thing.
    doNothing().when(thingHandler).accept(any());

    thingHandler.initialize();

    verify(callback).statusUpdated(eq(thing), argThat((arg) -> arg.getStatus().equals(ThingStatus.OFFLINE)
            && arg.getStatusDetail().equals(ThingStatusDetail.COMMUNICATION_ERROR)));
}
 
示例22
@Override
public void receiveTypedEvent(ThingStatusInfoChangedEvent event) {
    if (autoIgnore) {
        Thing thing = thingRegistry.get(event.getThingUID());
        ThingStatus thingStatus = event.getStatusInfo().getStatus();
        autoIgnore(thing, thingStatus);
    }
}
 
示例23
@Override
public void setStatus(ThingStatus status, ThingStatusDetail statusDetail) {
    if (active && getBridge().getStatus() != ThingStatus.OFFLINE && status != ThingStatus.ONLINE) {
        updateStatus(status, statusDetail);
        // we are offline and lost our observe relation - let's try to establish the connection in 10 seconds again
        scheduler.schedule(() -> {
            if (observeRelation != null) {
                observeRelation.reactiveCancel();
                observeRelation = null;
            }
            observeRelation = coapClient.startObserve(this);
        }, 10, TimeUnit.SECONDS);
    }
}
 
示例24
@Override
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
    if (bridgeStatusInfo.getStatus().equals(ThingStatus.ONLINE)) {
        if (dSID != null) {
            if (getDssBridgeHandler() != null) {
                if (device == null) {
                    updateStatus(ThingStatus.ONLINE, ThingStatusDetail.CONFIGURATION_PENDING,
                            "waiting for listener registration");
                    dssBridgeHandler.registerDeviceStatusListener(this);
                } else {
                    updateStatus(ThingStatus.ONLINE);
                }
            } else {
                updateStatus(ThingStatus.OFFLINE);
            }
        } else {
            updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "No dSID is set!");
        }
    }
    if (bridgeStatusInfo.getStatus().equals(ThingStatus.OFFLINE)) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
    }
    if (bridgeStatusInfo.getStatus().equals(ThingStatus.REMOVED)) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.NONE, "Bridge has been removed.");
    }
    logger.debug("Set status to {}", getThing().getStatusInfo());
}
 
示例25
/**
 * Updates the state of the given channel.
 */
protected void handleRefresh(ChannelUID channelUID) {
    try {
        if (thing.getStatus() == ThingStatus.ONLINE) {
            logger.debug("Updating channel '{}' from thing id '{}'", channelUID, getThing().getUID().getId());
            updateChannelState(channelUID);
        }
    } catch (Exception ex) {
        logger.warn("{}", ex.getMessage());
    }
}
 
示例26
@Override
public void run() {
    try {
        if (!isUpnpDeviceRegistered()) {
            logger.debug("WeMo UPnP device {} not yet registered", getUDN());
        }

        updateWemoState();
        onSubscription();
    } catch (Exception e) {
        logger.debug("Exception during poll : {}", e);
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
    }
}
 
示例27
@Override
public void bridgeStatusChanged(ThingStatusInfo bridgeStatusInfo) {
    if (bridgeStatusInfo.getStatus() == ThingStatus.ONLINE
            && getThing().getStatusInfo().getStatusDetail() == ThingStatusDetail.BRIDGE_OFFLINE) {
        updateStatus(ThingStatus.ONLINE, ThingStatusDetail.NONE);
    } else if (bridgeStatusInfo.getStatus() == ThingStatus.OFFLINE) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.BRIDGE_OFFLINE);
    }
}
 
示例28
@Test
public void initializeShouldCallTheCallback() {
    // mock getConfiguration to prevent NPEs
    when(thing.getConfiguration()).thenReturn(new Configuration());
    
    // we expect the handler#initialize method to call the callback during execution and
    // pass it the thing and a ThingStatusInfo object containing the ThingStatus of the thing.
    handler.initialize();

    // the argument captor will capture the argument of type ThingStatusInfo given to the
    // callback#statusUpdated method.
    ArgumentCaptor<ThingStatusInfo> statusInfoCaptor = ArgumentCaptor.forClass(ThingStatusInfo.class);

    // verify the interaction with the callback and capture the ThingStatusInfo argument:
    waitForAssert(() -> {
        verify(callback, times(2)).statusUpdated(eq(thing), statusInfoCaptor.capture());
    });
    
    // assert that the (temporary) UNKNOWN status was given first:
    assertThat(statusInfoCaptor.getAllValues().get(0).getStatus(), is(ThingStatus.UNKNOWN));
    
    
    // assert that ONLINE status was given later:
    assertThat(statusInfoCaptor.getAllValues().get(1).getStatus(), is(ThingStatus.ONLINE));

    
    // See the documentation at 
    // https://www.eclipse.org/smarthome/documentation/development/testing.html#assertions 
    // to see when to use Hamcrest assertions (assertThat) or JUnit assertions. 
}
 
示例29
/**
 * Updates the status of the thing.
 *
 * @param status the status
 * @param statusDetail the detail of the status
 * @param description the description of the status
 */
protected void updateStatus(ThingStatus status, ThingStatusDetail statusDetail, @Nullable String description) {
    synchronized (this) {
        if (this.callback != null) {
            ThingStatusInfoBuilder statusBuilder = ThingStatusInfoBuilder.create(status, statusDetail);
            ThingStatusInfo statusInfo = statusBuilder.withDescription(description).build();
            this.callback.statusUpdated(this.thing, statusInfo);
        } else {
            logger.warn("Handler {} tried updating the thing status although the handler was already disposed.",
                    this.getClass().getSimpleName());
        }
    }
}
 
示例30
@Override
public void initialize() {
    try {
        address = new BluetoothAddress(getConfig().get(BluetoothBindingConstants.CONFIGURATION_ADDRESS).toString());
    } catch (IllegalArgumentException e) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, e.getLocalizedMessage());
        return;
    }

    Bridge bridge = getBridge();
    if (bridge == null) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR, "Not associated with any bridge");
        return;
    }

    BridgeHandler bridgeHandler = bridge.getHandler();
    if (!(bridgeHandler instanceof BluetoothAdapter)) {
        updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.CONFIGURATION_ERROR,
                "Associated with an unsupported bridge");
        return;
    }

    adapter = (BluetoothAdapter) bridgeHandler;

    try {
        deviceLock.lock();
        device = adapter.getDevice(address);
        device.addListener(this);
    } finally {
        deviceLock.unlock();
    }

    updateStatus(ThingStatus.UNKNOWN);
}