mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[nanoleaf] Suppress ipv6 addr in controller discovery (#17724)
* stabilize nanoleaf binding:suppress ipv6 addresses in controller discovery Signed-off-by: Stefan Höhn <stefan.hoehn@nfon.com>
This commit is contained in:
parent
da97e57aac
commit
987b894458
@ -132,22 +132,8 @@ The controller thing has the following parameters:
|
|||||||
**Important note on the topic of IPV6 ip addresses:**
|
**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.
|
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.
|
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.
|
||||||
It is therefore recommended to disable IPv6 on the openHAB server.
|
To avoid this, the binding will only discover devices based on their IPv4 address.
|
||||||
|
|
||||||
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
|
|
||||||
```
|
|
||||||
|
|
||||||
Reboot your server after the change.
|
Reboot your server after the change.
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ package org.openhab.binding.nanoleaf.internal.discovery;
|
|||||||
|
|
||||||
import static org.openhab.binding.nanoleaf.internal.NanoleafBindingConstants.*;
|
import static org.openhab.binding.nanoleaf.internal.NanoleafBindingConstants.*;
|
||||||
|
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.UnknownHostException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -66,6 +68,15 @@ public class NanoleafMDNSDiscoveryParticipant implements MDNSDiscoveryParticipan
|
|||||||
}
|
}
|
||||||
final Map<String, Object> properties = new HashMap<>(2);
|
final Map<String, Object> properties = new HashMap<>(2);
|
||||||
String host = service.getHostAddresses()[0];
|
String host = service.getHostAddresses()[0];
|
||||||
|
try {
|
||||||
|
if (InetAddress.getByName(host).getAddress().length != 4) {
|
||||||
|
logger.debug("Ignoring IPv6 address for nanoleaf controllers: {}", host);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (UnknownHostException e) {
|
||||||
|
logger.warn("Error while checking IP address for nanoleaf controller: {}", host);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
properties.put(CONFIG_ADDRESS, host);
|
properties.put(CONFIG_ADDRESS, host);
|
||||||
int port = service.getPort();
|
int port = service.getPort();
|
||||||
properties.put(CONFIG_PORT, port);
|
properties.put(CONFIG_PORT, port);
|
||||||
|
Loading…
Reference in New Issue
Block a user