[SOLVED] Representation-property does not work?

discovery
devicediscovery
inbox
Tags: #<Tag:0x00007f51f2e82308> #<Tag:0x00007f51f2e82178> #<Tag:0x00007f51f2e81ef8>

(Massimo) #1

Hallo,
according to OH Thing Discovery, discovery results matching Things that have been already created (manually) with same representation property value, will be ignored and not added to Inbox.

In my binding I have ownID parameter declared as representation-property for all Things:

<representation-property>ownId</representation-property>

however after I create this thing manually:

/rest/things:
{
  label: "Living Room Light",
  properties: {
     ownId: "1.51"
[...]

and do a device scan, I can find in my Inbox this new device:

/rest/inbox:
{
  bridgeUID: "openwebnet:bus_gateway:mybridge",
  flag: "NEW",
  label: "Switch (WHERE=51)",
  properties: {
      where: "51",
      ownId: "1.51"
  },
  thingUID: "openwebnet:bus_on_off_switch:mybridge:51",
  thingTypeUID: "openwebnet:bus_on_off_switch"
}

as you can see the Discovery Result in Ibox and the thing created manually have the same representation property value:

ownId: "1.51"

How can this be possible?
Is something wrong in my Thing definition?

(I am on OH 2.5.0.SNAPSHOT)

thanks bye,
Massi


(David Graeff) #2

The ‚Äúrepresentation property‚ÄĚ field also need to be set by the binding within the discovery service when you construct the DiscoveryResult. It is not enough to specify it in the xml.

Cheers, David


(Massimo) #3

Hi David,
thanks for the suggestion.
However I confirm the property has been set within the discovery service:

properties.put("ownId", ownId);
discoveryResult = DiscoveryResultBuilder.create(thingUID).withThingType(thingTypeUID).withProperties(properties)
                .withBridge(bridgeUID).withLabel(thingLabel).build();

in fact as you can see in my previous message the device in inbox has the property set correctly.

Any other idea? or thing I could check?
ciao
Massi


(David Graeff) #4

(Massimo) #5

Now I got it how it should work! Thanks!