Devices can also be discovered if activated while an Inbox Scan is active: start a new Scan, wait 15-20 seconds and then _while the Scan is still active_ (spinning arrow in Inbox), activate the physical device (for example dim the dimmer) to have it discovered by the binding.
-If a device cannot be discovered automatically it's always possible to add them manually, see [Configuring Devices](#configuring-devices).
+If a device cannot be discovered automatically it's always possible to add it manually, see [Configuring Devices](#configuring-devices).
### ZigBee Discovery
[@k0nti](https://community.openhab.org/u/k0nti/),
[@gilberto.cocchi](https://community.openhab.org/u/gilberto.cocchi/),
[@llegovich](https://community.openhab.org/u/llegovich),
-[@gabriele.daltoe](https://community.openhab.org/u/gabriele.daltoe)
+[@gabriele.daltoe](https://community.openhab.org/u/gabriele.daltoe),
+[@feodor](https://community.openhab.org/u/feodor)
and many others at the fantastic openHAB community!
<dependency>
<groupId>com.github.openwebnet4j</groupId>
<artifactId>openwebnet4j</artifactId>
- <version>0.3.0</version>
+ <version>0.3.1</version>
<scope>compile</scope>
</dependency>
/**
* Un-register a device from this bridge handler
*
- * @param oId the device OpenWebNet id
+ * @param ownId the device OpenWebNet id
*/
- protected void unregisterDevice(String oId) {
- if (registeredDevices.remove(oId) != null) {
- logger.debug("un-registered device ownId={}", oId);
+ protected void unregisterDevice(String ownId) {
+ if (registeredDevices.remove(ownId) != null) {
+ logger.debug("un-registered device ownId={}", ownId);
} else {
- logger.warn("could not un-register ownId={} (not found)", oId);
+ logger.warn("could not un-register ownId={} (not found)", ownId);
}
}
+ /**
+ * Get an already registered device on this bridge handler
+ *
+ * @param ownId the device OpenWebNet id
+ * @return the registered device Thing handler or null if the id cannot be found
+ */
+ public @Nullable OpenWebNetThingHandler getRegisteredDevice(String ownId) {
+ return registeredDevices.get(ownId);
+ }
+
@Override
public void onEventMessage(@Nullable OpenMessage msg) {
logger.trace("RECEIVED <<<<< {}", msg);
deviceWho = baseMsg.getWho();
}
}
+
+ String ownId = bridgeHandler.ownIdFromWhoWhere(where, deviceWho);
+ if (thingTypeUID == OpenWebNetBindingConstants.THING_TYPE_BUS_ON_OFF_SWITCH) {
+ if (bridgeHandler.getRegisteredDevice(ownId) != null) {
+ logger.debug("dimmer/switch with WHERE={} already registered, skipping this discovery result", where);
+ return;
+ }
+ }
+
String tId = bridgeHandler.thingIdFromWhere(where);
ThingUID thingUID = new ThingUID(thingTypeUID, bridgeUID, tId);
}
Map<String, Object> properties = new HashMap<>(2);
properties.put(OpenWebNetBindingConstants.CONFIG_PROPERTY_WHERE, bridgeHandler.normalizeWhere(where));
- properties.put(OpenWebNetBindingConstants.PROPERTY_OWNID, bridgeHandler.ownIdFromWhoWhere(where, deviceWho));
+ properties.put(OpenWebNetBindingConstants.PROPERTY_OWNID, ownId);
if (thingTypeUID == OpenWebNetBindingConstants.THING_TYPE_GENERIC_DEVICE) {
thingLabel = thingLabel + " (WHO=" + deviceWho + ", WHERE=" + whereLabel + ")";
} else {