Hi,
in my binding when I receive a response to a device search method I create a new DiscoveryResult
with ThingTypeUID "A"
.
Sometimes, but not always, a second further response to the device search is received from the protocol, giving more details about the device discovered which needs changing its ThingType.
Thus the previous DiscoveryResult
should be updated to ThingTypeUID "B"
, and therefore also the ThingUID will be different, so Inbox will not automatically remove the previous discovery.
In the past I achieved this device type change with:
// 2nd device search message received...
// get old discovered DiscoveryResult
discoveryResult = discoveryServiceCallback.getExistingDiscoveryResult(thingUID);
if (discoveryResult != null) {
// remove previously discovered thing
thingRemoved(thingUID);
}
// create new thingUID with new type and create new DiscoveryResult
thingUID = new ThingUID(thingTypeUID, bridgeUID, ....);
newDiscoveryResult = DiscoveryResultBuilder.create(thingUID).withThingType(thingTypeUID).build();
thingDiscovered(newDiscoveryResult);
This worked for me but unfortunately now DiscoveryServiceCallback
is deprecated.
How can I remove a previous DiscoveryResult
from Inbox programmactically, to change it with a new DiscoveryResult with a different device type and ThingUID ?
Thanks,
Massi