Added representation-property to thing type definitions (#11640)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp 2021-11-26 23:01:44 +01:00 committed by GitHub
parent 0797e5d611
commit addb990a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 9 deletions

View 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;

View 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>