[hdpowerview] discovery could wrongly return a ThingUID based on a hub's Ipv6 address instead of its Ipv4 address (#8778)
Signed-off-by: Andrew Fiddian-Green <software@whitebear.ch>
This commit is contained in:
parent
5fd82c5aa3
commit
5fe7cc5810
@ -75,8 +75,10 @@ public class HDPowerViewHubDiscoveryParticipant implements MDNSDiscoveryParticip
|
|||||||
@Override
|
@Override
|
||||||
public @Nullable ThingUID getThingUID(ServiceInfo service) {
|
public @Nullable ThingUID getThingUID(ServiceInfo service) {
|
||||||
for (String host : service.getHostAddresses()) {
|
for (String host : service.getHostAddresses()) {
|
||||||
|
if (VALID_IP_V4_ADDRESS.matcher(host).matches()) {
|
||||||
return new ThingUID(THING_TYPE_HUB, host.replace('.', '_'));
|
return new ThingUID(THING_TYPE_HUB, host.replace('.', '_'));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user