]> git.basschouten.com Git - openhab-addons.git/commitdiff
[openwebnet] Thermo: zone/CU address set correctly during discovery (#13803)
authorM Valla <12682715+mvalla@users.noreply.github.com>
Tue, 29 Nov 2022 11:08:22 +0000 (12:08 +0100)
committerGitHub <noreply@github.com>
Tue, 29 Nov 2022 11:08:22 +0000 (12:08 +0100)
Fixes #13761

Signed-off-by: Massimo Valla <mvcode00@gmail.com>
bundles/org.openhab.binding.openwebnet/README.md
bundles/org.openhab.binding.openwebnet/src/main/java/org/openhab/binding/openwebnet/internal/discovery/OpenWebNetDeviceDiscoveryService.java

index d03229e9b5a63e8f2135e03ee1600a3f0a8a6d7b..8a14103fcd08a282af3281e02274f258462ccc48 100644 (file)
@@ -155,7 +155,7 @@ Temperature sensors can be configured defining a `bus_thermo_sensor` Thing with
     - example sensor `5` of external zone `00` --> `where="500"`
     - example: slave sensor `3` of zone `2` --> `where="302"`
 
-The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing.
+The (optional) Central Unit can be configured defining a `bus_themo_cu` Thing with the `where` configuration parameter (`OpenWebNet Address`) set to `where="0"`.
 
 ##### Central Unit integration missing points 
 
index aa3ecbb1eccfda1ec24d61d931bd0d56161029ee..ce6264c0fcb52575300dc31ce7b542c132b9f0b8 100644 (file)
@@ -31,14 +31,15 @@ import org.openhab.core.thing.binding.ThingHandlerService;
 import org.openwebnet4j.OpenDeviceType;
 import org.openwebnet4j.message.BaseOpenMessage;
 import org.openwebnet4j.message.Where;
+import org.openwebnet4j.message.WhereThermo;
 import org.openwebnet4j.message.WhereZigBee;
 import org.openwebnet4j.message.Who;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
- * The {@link OpenWebNetDeviceDiscoveryService} is responsible for discovering OpenWebNet devices connected to a
- * bridge/gateway
+ * The {@link OpenWebNetDeviceDiscoveryService} is responsible for discovering
+ * OpenWebNet devices connected to a bridge/gateway
  *
  * @author Massimo Valla - Initial contribution
  * @author Andrea Conte - Energy management, Thermoregulation
@@ -86,14 +87,16 @@ public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService
     }
 
     /**
-     * Create and notify to Inbox a new DiscoveryResult based on WHERE, OpenDeviceType and BaseOpenMessage
+     * Create and notify to Inbox a new DiscoveryResult based on WHERE,
+     * OpenDeviceType and BaseOpenMessage
      *
      * @param where the discovered device's address (WHERE)
      * @param deviceType {@link OpenDeviceType} of the discovered device
-     * @param message the OWN message received that identified the device (optional)
+     * @param message the OWN message received that identified the device
+     *            (optional)
      */
     public void newDiscoveryResult(Where where, OpenDeviceType deviceType, @Nullable BaseOpenMessage baseMsg) {
-        logger.info("newDiscoveryResult() WHERE={}, deviceType={}", where, deviceType);
+        logger.debug("newDiscoveryResult() WHERE={}, deviceType={}", where, deviceType);
         ThingTypeUID thingTypeUID = OpenWebNetBindingConstants.THING_TYPE_GENERIC_DEVICE; // generic device
         String thingLabel = OpenWebNetBindingConstants.THING_LABEL_GENERIC_DEVICE;
         Who deviceWho = Who.UNKNOWN;
@@ -210,6 +213,12 @@ public class OpenWebNetDeviceDiscoveryService extends AbstractDiscoveryService
         DiscoveryResult discoveryResult = null;
 
         String whereConfig = where.value();
+
+        // remove # from discovered thermo zone or central unit
+        if (OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_ZONE.equals(thingTypeUID)
+                || OpenWebNetBindingConstants.THING_TYPE_BUS_THERMO_CU.equals(thingTypeUID)) {
+            whereConfig = "" + ((WhereThermo) where).getZone();
+        }
         if (where instanceof WhereZigBee && WhereZigBee.UNIT_02.equals(((WhereZigBee) where).getUnit())) {
             logger.debug("UNIT=02 found (WHERE={}) -> will remove previous result if exists", where);
             thingRemoved(thingUID); // remove previously discovered thing