Added representation-property to thing type definitions (#11640)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
0797e5d611
commit
addb990a5b
|
@ -16,7 +16,6 @@ import static org.openhab.binding.avmfritz.internal.AVMFritzBindingConstants.*;
|
||||||
import static org.openhab.core.thing.Thing.PROPERTY_VENDOR;
|
import static org.openhab.core.thing.Thing.PROPERTY_VENDOR;
|
||||||
|
|
||||||
import java.util.Dictionary;
|
import java.util.Dictionary;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
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.DiscoveryResult;
|
||||||
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
|
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
|
||||||
import org.openhab.core.config.discovery.upnp.UpnpDiscoveryParticipant;
|
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.ThingTypeUID;
|
||||||
import org.openhab.core.thing.ThingUID;
|
import org.openhab.core.thing.ThingUID;
|
||||||
import org.osgi.service.component.ComponentContext;
|
import org.osgi.service.component.ComponentContext;
|
||||||
|
@ -83,16 +83,11 @@ public class AVMFritzUpnpDiscoveryParticipant implements UpnpDiscoveryParticipan
|
||||||
if (uid != null) {
|
if (uid != null) {
|
||||||
logger.debug("discovered: {} ({}) at {}", device.getDisplayString(),
|
logger.debug("discovered: {} ({}) at {}", device.getDisplayString(),
|
||||||
device.getDetails().getFriendlyName(), device.getIdentity().getDescriptorURL().getHost());
|
device.getDetails().getFriendlyName(), device.getIdentity().getDescriptorURL().getHost());
|
||||||
|
return DiscoveryResultBuilder.create(uid)
|
||||||
Map<String, Object> properties = new HashMap<>();
|
.withProperties(Map.of(CONFIG_IP_ADDRESS, device.getIdentity().getDescriptorURL().getHost(),
|
||||||
properties.put(CONFIG_IP_ADDRESS, device.getIdentity().getDescriptorURL().getHost());
|
PROPERTY_VENDOR, device.getDetails().getManufacturerDetails().getManufacturer()))
|
||||||
properties.put(PROPERTY_VENDOR, device.getDetails().getManufacturerDetails().getManufacturer());
|
|
||||||
|
|
||||||
DiscoveryResult result = DiscoveryResultBuilder.create(uid).withProperties(properties)
|
|
||||||
.withLabel(device.getDetails().getFriendlyName()).withRepresentationProperty(CONFIG_IP_ADDRESS)
|
.withLabel(device.getDetails().getFriendlyName()).withRepresentationProperty(CONFIG_IP_ADDRESS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -17,6 +17,8 @@
|
||||||
<channel id="apply_template" typeId="apply_template"/>
|
<channel id="apply_template" typeId="apply_template"/>
|
||||||
</channels>
|
</channels>
|
||||||
|
|
||||||
|
<representation-property>ipAddress</representation-property>
|
||||||
|
|
||||||
<config-description-ref uri="bridge-type:avmfritz:fritzbox"/>
|
<config-description-ref uri="bridge-type:avmfritz:fritzbox"/>
|
||||||
</bridge-type>
|
</bridge-type>
|
||||||
|
|
||||||
|
@ -34,6 +36,8 @@
|
||||||
<channel id="outlet" typeId="outlet"/>
|
<channel id="outlet" typeId="outlet"/>
|
||||||
</channels>
|
</channels>
|
||||||
|
|
||||||
|
<representation-property>ipAddress</representation-property>
|
||||||
|
|
||||||
<config-description-ref uri="bridge-type:avmfritz:fritzpowerline"/>
|
<config-description-ref uri="bridge-type:avmfritz:fritzpowerline"/>
|
||||||
</bridge-type>
|
</bridge-type>
|
||||||
</thing:thing-descriptions>
|
</thing:thing-descriptions>
|
||||||
|
|
Loading…
Reference in New Issue