diff --git a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/discovery/NanoleafMDNSDiscoveryParticipant.java b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/discovery/NanoleafMDNSDiscoveryParticipant.java index b5e1cf9191635..9dd611dfa30e5 100644 --- a/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/discovery/NanoleafMDNSDiscoveryParticipant.java +++ b/bundles/org.openhab.binding.nanoleaf/src/main/java/org/openhab/binding/nanoleaf/internal/discovery/NanoleafMDNSDiscoveryParticipant.java @@ -14,6 +14,8 @@ import static org.openhab.binding.nanoleaf.internal.NanoleafBindingConstants.*; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.HashMap; import java.util.Map; import java.util.Set; @@ -66,6 +68,15 @@ public String getServiceType() { } final Map properties = new HashMap<>(2); String host = service.getHostAddresses()[0]; + try { + if (InetAddress.getByName(host).getAddress().length != 4) { + logger.info("Ignoring IPv6 address for nanoleaf controllers: {}", host); + return null; + } + } catch (UnknownHostException e) { + logger.error("Error while checking IP address for nanoleaf controller: {}", host); + return null; + } properties.put(CONFIG_ADDRESS, host); int port = service.getPort(); properties.put(CONFIG_PORT, port);