From 5fe7cc5810bcebded339300c47a38bcb68e46ce0 Mon Sep 17 00:00:00 2001 From: Andrew Fiddian-Green Date: Sun, 18 Oct 2020 19:26:50 +0100 Subject: [PATCH] [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 --- .../discovery/HDPowerViewHubDiscoveryParticipant.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewHubDiscoveryParticipant.java b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewHubDiscoveryParticipant.java index eb057832703..a9b4ba7e818 100644 --- a/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewHubDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.hdpowerview/src/main/java/org/openhab/binding/hdpowerview/internal/discovery/HDPowerViewHubDiscoveryParticipant.java @@ -75,7 +75,9 @@ public class HDPowerViewHubDiscoveryParticipant implements MDNSDiscoveryParticip @Override public @Nullable ThingUID getThingUID(ServiceInfo service) { for (String host : service.getHostAddresses()) { - return new ThingUID(THING_TYPE_HUB, host.replace('.', '_')); + if (VALID_IP_V4_ADDRESS.matcher(host).matches()) { + return new ThingUID(THING_TYPE_HUB, host.replace('.', '_')); + } } return null; }