mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[hue] Fix migration of API v1 legacy data to new v2 things (#16714)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
parent
62e62e66a4
commit
1d3c52a33d
@ -203,7 +203,6 @@ public class HueCommandExtension extends AbstractConsoleCommandExtension impleme
|
||||
Optional<Thing> legacyThingOptional = clip2BridgeHandler.getLegacyThing(idv1);
|
||||
if (legacyThingOptional.isPresent()) {
|
||||
Thing legacyThing = legacyThingOptional.get();
|
||||
thingId = legacyThing.getUID().getId();
|
||||
String legacyLabel = legacyThing.getLabel();
|
||||
thingLabel = Objects.nonNull(legacyLabel) ? legacyLabel : thingLabel;
|
||||
}
|
||||
|
@ -121,7 +121,6 @@ public class Clip2ThingDiscoveryService extends AbstractThingHandlerDiscoverySer
|
||||
if (legacyThingOptional.isPresent()) {
|
||||
Thing legacyThing = legacyThingOptional.get();
|
||||
legacyThingUID = legacyThing.getUID().getAsString();
|
||||
thingId = legacyThing.getUID().getId();
|
||||
String legacyLabel = legacyThing.getLabel();
|
||||
thingLabel = Objects.nonNull(legacyLabel) ? legacyLabel : thingLabel;
|
||||
}
|
||||
|
@ -366,13 +366,11 @@ public class Clip2BridgeHandler extends BaseBridgeHandler {
|
||||
}
|
||||
|
||||
ThingUID legacyBridgeUID = legacyBridge.get().getUID();
|
||||
return thingRegistry.getAll().stream() //
|
||||
return thingRegistry.getAll().stream()
|
||||
.filter(thing -> legacyBridgeUID.equals(thing.getBridgeUID())
|
||||
&& V1_THING_TYPE_UIDS.contains(thing.getThingTypeUID())) //
|
||||
.filter(thing -> {
|
||||
Object id = thing.getConfiguration().get(config);
|
||||
return (id instanceof String) && targetIdV1.endsWith("/" + (String) id);
|
||||
}).findFirst();
|
||||
&& V1_THING_TYPE_UIDS.contains(thing.getThingTypeUID())
|
||||
&& thing.getConfiguration().get(config) instanceof String id && targetIdV1.endsWith("/" + id))
|
||||
.findFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user