]> git.basschouten.com Git - openhab-addons.git/commitdiff
Added representation-property to thing type definitions (#11640)
authorChristoph Weitkamp <github@christophweitkamp.de>
Fri, 26 Nov 2021 22:01:44 +0000 (23:01 +0100)
committerGitHub <noreply@github.com>
Fri, 26 Nov 2021 22:01:44 +0000 (23:01 +0100)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
bundles/org.openhab.binding.avmfritz/src/main/java/org/openhab/binding/avmfritz/internal/discovery/AVMFritzUpnpDiscoveryParticipant.java
bundles/org.openhab.binding.avmfritz/src/main/resources/OH-INF/thing/bridge-types.xml

index b9c2e14069d33b427e6884c2bb015bd43e453e50..fa42200ce5a0a008409a3abc3053830cf694c70f 100644 (file)
@@ -16,7 +16,6 @@ import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.*;
 import static org.openhab.core.thing.Thing.PROPERTY_VENDOR;
 
 import java.util.Dictionary;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
@@ -28,6 +27,7 @@ import org.jupnp.model.meta.RemoteDevice;
 import org.openhab.core.config.discovery.DiscoveryResult;
 import org.openhab.core.config.discovery.DiscoveryResultBuilder;
 import org.openhab.core.config.discovery.upnp.UpnpDiscoveryParticipant;
+import org.openhab.core.config.discovery.upnp.internal.UpnpDiscoveryService;
 import org.openhab.core.thing.ThingTypeUID;
 import org.openhab.core.thing.ThingUID;
 import org.osgi.service.component.ComponentContext;
@@ -83,16 +83,11 @@ public class AVMFritzUpnpDiscoveryParticipant implements UpnpDiscoveryParticipan
             if (uid != null) {
                 logger.debug("discovered: {} ({}) at {}", device.getDisplayString(),
                         device.getDetails().getFriendlyName(), device.getIdentity().getDescriptorURL().getHost());
-
-                Map<String, Object> properties = new HashMap<>();
-                properties.put(CONFIG_IP_ADDRESS, device.getIdentity().getDescriptorURL().getHost());
-                properties.put(PROPERTY_VENDOR, device.getDetails().getManufacturerDetails().getManufacturer());
-
-                DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties)
+                return DiscoveryResultBuilder.create(uid)
+                        .withProperties(Map.of(CONFIG_IP_ADDRESS, device.getIdentity().getDescriptorURL().getHost(),
+                                PROPERTY_VENDOR, device.getDetails().getManufacturerDetails().getManufacturer()))
                         .withLabel(device.getDetails().getFriendlyName()).withRepresentationProperty(CONFIG_IP_ADDRESS)
                         .build();
-
-                return result;
             }
         }
         return null;
index 8823f8c37967e38715be0148963715b0c9bafe3d..a3aa4405332bcf4b5b4ecde0a3b8726fc34c160a 100644 (file)
@@ -17,6 +17,8 @@
                        <channel id="apply_template" typeId="apply_template"/>
                </channels>
 
+               <representation-property>ipAddress</representation-property>
+
                <config-description-ref uri="bridge-type:avmfritz:fritzbox"/>
        </bridge-type>
 
@@ -34,6 +36,8 @@
                        <channel id="outlet" typeId="outlet"/>
                </channels>
 
+               <representation-property>ipAddress</representation-property>
+
                <config-description-ref uri="bridge-type:avmfritz:fritzpowerline"/>
        </bridge-type>
 </thing:thing-descriptions>