From 9947bb9101a81f2f7983af52c02a550e6e34b0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=B6hn?= Date: Sat, 9 Nov 2024 22:06:20 +0100 Subject: [PATCH 1/5] stabilize nanoleaf binding:suppress ipv6 addresses in controller discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Höhn --- .../discovery/NanoleafMDNSDiscoveryParticipant.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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); From 0128d1a5be3c195c3a526344472c2e5c80336d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=B6hn?= Date: Sat, 9 Nov 2024 22:22:21 +0100 Subject: [PATCH 2/5] stabilize nanoleaf binding:suppress ipv6 addresses in controller discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Höhn --- .../internal/discovery/NanoleafMDNSDiscoveryParticipant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 9dd611dfa30e5..7b9a58f0c1fb9 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 @@ -70,7 +70,7 @@ public String getServiceType() { String host = service.getHostAddresses()[0]; try { if (InetAddress.getByName(host).getAddress().length != 4) { - logger.info("Ignoring IPv6 address for nanoleaf controllers: {}", host); + logger.debug("Ignoring IPv6 address for nanoleaf controllers: {}", host); return null; } } catch (UnknownHostException e) { From c1563136e20ac797a5a0543d4d4a2a287da67f7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=B6hn?= Date: Sun, 10 Nov 2024 07:57:28 +0100 Subject: [PATCH 3/5] document suppressing ipv6 addresses in controller discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Höhn --- bundles/org.openhab.binding.nanoleaf/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bundles/org.openhab.binding.nanoleaf/README.md b/bundles/org.openhab.binding.nanoleaf/README.md index 9c939132a6e6d..82d3307a2d1aa 100644 --- a/bundles/org.openhab.binding.nanoleaf/README.md +++ b/bundles/org.openhab.binding.nanoleaf/README.md @@ -40,6 +40,8 @@ You can set the **color** for each panel and in the case of a Nanoleaf Canvas or ## Discovery +Note that the discovery is based upon IP V4 addresses as the binding does not support IP V6 addresses. + ### Adding the Controller as a Thing To add a nanoleaf controller, go to your inbox and start a scan. From 9e7568b23d13a79b367d66f293bd44a21e3fa2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=B6hn?= Date: Sun, 10 Nov 2024 08:00:27 +0100 Subject: [PATCH 4/5] document suppressing ipv6 addresses in controller discovery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Höhn --- .../org.openhab.binding.nanoleaf/README.md | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/bundles/org.openhab.binding.nanoleaf/README.md b/bundles/org.openhab.binding.nanoleaf/README.md index 82d3307a2d1aa..72cabbba1a74e 100644 --- a/bundles/org.openhab.binding.nanoleaf/README.md +++ b/bundles/org.openhab.binding.nanoleaf/README.md @@ -40,8 +40,6 @@ You can set the **color** for each panel and in the case of a Nanoleaf Canvas or ## Discovery -Note that the discovery is based upon IP V4 addresses as the binding does not support IP V6 addresses. - ### Adding the Controller as a Thing To add a nanoleaf controller, go to your inbox and start a scan. @@ -134,22 +132,8 @@ The controller thing has the following parameters: **Important note on the topic of IPV6 ip addresses:** With firmware version 8.5.2 or newer, panels may change between being OFFLINE and ONLINE. -This is due to the fact that if they are discovered with IPv6 addresses, the binding is not able to correctly send API requests to the devices. -It is therefore recommended to disable IPv6 on the openHAB server. - -This can e.g. be achieved on openHABian the following way: - -```shell -sudo nano /etc/sysctl.conf` -``` - -Add the following at the bottom of the file: - -```ini -net.ipv6.conf.all.disable_ipv6 = 1 -net.ipv6.conf.default.disable_ipv6 = 1 -net.ipv6.conf.lo.disable_ipv6 = 1 -``` +This is because if they are discovered with IPv6 addresses, the binding is not able to correctly send API requests to the devices which leads to an unstable behaviour. +To avoid this, the binding will only discover devices based on their IPv4 address. Reboot your server after the change. From bd98059e57eef30a8bb28e5293b055237c941e1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20H=C3=B6hn?= Date: Sun, 10 Nov 2024 13:37:43 +0100 Subject: [PATCH 5/5] change loglevel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Höhn --- .../internal/discovery/NanoleafMDNSDiscoveryParticipant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 7b9a58f0c1fb9..dc6dcd6562b1e 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 @@ -74,7 +74,7 @@ public String getServiceType() { return null; } } catch (UnknownHostException e) { - logger.error("Error while checking IP address for nanoleaf controller: {}", host); + logger.warn("Error while checking IP address for nanoleaf controller: {}", host); return null; } properties.put(CONFIG_ADDRESS, host);