diff --git a/bundles/org.openhab.io.homekit/README.md b/bundles/org.openhab.io.homekit/README.md index 20323057a80f2..2286bc53258a5 100644 --- a/bundles/org.openhab.io.homekit/README.md +++ b/bundles/org.openhab.io.homekit/README.md @@ -96,23 +96,25 @@ org.openhab.homekit:blockUserDeletion=false org.openhab.homekit:name=openHAB org.openhab.homekit:instances=1 org.openhab.homekit:useDummyAccessories=false +org.openhab.homekit:listenToNetworkChanges=true ``` Some settings are only visible in UI if the checkbox "Show advanced" is activated. ### Overview of all settings -| Setting | Description | Default value | -|:-------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:---------------------| -| networkInterface | IP address or domain name under which the HomeKit bridge can be reached. If no value is configured, the add-on uses the primary IP address configured for openHAB. If unsure, keep it empty | (none) | -| port | Port under which the HomeKit bridge can be reached. | 9123 | -| useOHmDNS | mDNS service is used to advertise openHAB as HomeKit bridge in the network so that HomeKit clients can find it. openHAB has already mDNS service running. This option defines whether the mDNS service of openHAB or a separate service should be used. | false | -| blockUserDeletion | Blocks HomeKit user deletion in openHAB and as result unpairing of devices. If you experience an issue with accessories becoming non-responsive after some time, try to enable this setting. You can also enable this setting if your HomeKit setup is done and you will not re-pair ios devices. | false | -| pin | Pin code used for pairing with iOS devices. Apparently, pin codes are provided by Apple and represent specific device types, so they cannot be chosen freely. The pin code 031-45-154 is used in sample applications and known to work. | 031-45-154 | -| useFahrenheitTemperature | Set to true to use Fahrenheit degrees, or false to use Celsius degrees. Note if an item has a QuantityType as its state, this configuration is ignored and it's always converted properly. | false | -| name | Name under which this HomeKit bridge is announced on the network. This is also the name displayed on the iOS device when searching for available bridges. | openHAB | -| instances | Defines how many bridges to expose. Necessary if you have more than 149 accessories. Accessories must be assigned to additional instances via metadata. Additional bridges will use incrementing port numbers. | 1 | -| useDummyAccessories | When an accessory is missing, substitute a dummy in its place instead of removing it. See [Dummy Accessories](#dummy-accessories). | false | +| Setting | Description | Default value | +|:--------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------------| +| networkInterface | IP address or domain name under which the HomeKit bridge can be reached. If no value is configured, the add-on uses the primary IP address configured for openHAB. If unsure, keep it empty | (none) | +| port | Port under which the HomeKit bridge can be reached. | 9123 | +| useOHmDNS | mDNS service is used to advertise openHAB as HomeKit bridge in the network so that HomeKit clients can find it. openHAB has already mDNS service running. This option defines whether the mDNS service of openHAB or a separate service should be used. | false | +| blockUserDeletion | Blocks HomeKit user deletion in openHAB and as result unpairing of devices. If you experience an issue with accessories becoming non-responsive after some time, try to enable this setting. You can also enable this setting if your HomeKit setup is done and you will not re-pair ios devices. | false | +| pin | Pin code used for pairing with iOS devices. Apparently, pin codes are provided by Apple and represent specific device types, so they cannot be chosen freely. The pin code 031-45-154 is used in sample applications and known to work. | 031-45-154 | +| useFahrenheitTemperature | Set to true to use Fahrenheit degrees, or false to use Celsius degrees. Note if an item has a QuantityType as its state, this configuration is ignored and it's always converted properly. | false | +| name | Name under which this HomeKit bridge is announced on the network. This is also the name displayed on the iOS device when searching for available bridges. | openHAB | +| instances | Defines how many bridges to expose. Necessary if you have more than 149 accessories. Accessories must be assigned to additional instances via metadata. Additional bridges will use incrementing port numbers. | 1 | +| useDummyAccessories | When an accessory is missing, substitute a dummy in its place instead of removing it. See [Dummy Accessories](#dummy-accessories). | false | +| listenToNetworkChanges | Listen to network changes, e.g. changes of IP addresses, and restart HomeKit bridge. Disable in case of connectivity issues with HomeKit bridge. | true | ## Item Configuration diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java index 1f9682ae474cf..0c705ae713936 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitImpl.java @@ -412,10 +412,10 @@ public int getInstanceCount() { @Override public synchronized void onChanged(final List added, final List removed) { - logger.trace("HomeKit bridge reacting on network interface changes."); - if (!started) { + if (!started || !settings.listenToNetworkChanges) { return; } + logger.trace("HomeKit bridge reacting on network interface changes."); removed.forEach(i -> { logger.trace("removed interface {}", i.getAddress().toString()); if (i.getAddress().equals(networkInterface)) { diff --git a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java index 18c7465ff4884..1b38ce8021069 100644 --- a/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java +++ b/bundles/org.openhab.io.homekit/src/main/java/org/openhab/io/homekit/internal/HomekitSettings.java @@ -34,6 +34,7 @@ public class HomekitSettings { public boolean useFahrenheitTemperature = false; public boolean useOHmDNS = false; public boolean blockUserDeletion = false; + public boolean listenToNetworkChanges = true; public String networkInterface; @Override @@ -69,6 +70,8 @@ public boolean equals(Object obj) { return false; } else if (!blockUserDeletion != other.blockUserDeletion) { return false; + } else if (!listenToNetworkChanges != other.listenToNetworkChanges) { + return false; } else if (!pin.equals(other.pin)) { return false; } else if (!setupId.equals(other.setupId)) { diff --git a/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/config/config.xml b/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/config/config.xml index 117d29d1febae..7b01cfad76727 100644 --- a/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/config/config.xml +++ b/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/config/config.xml @@ -81,5 +81,11 @@ false true + + + Listen to changes on the network interface, e.g. changing of IP address, and restart HomeKit bridge. + true + true + diff --git a/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/i18n/homekit.properties b/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/i18n/homekit.properties index 40970eaeec08b..a843829ba8313 100644 --- a/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/i18n/homekit.properties +++ b/bundles/org.openhab.io.homekit/src/main/resources/OH-INF/i18n/homekit.properties @@ -30,3 +30,5 @@ io.config.homekit.useFahrenheitTemperature.label = Use Fahrenheit Temperature io.config.homekit.useFahrenheitTemperature.description = Defines whether or not to direct HomeKit clients to use fahrenheit temperatures instead of celsius. io.config.homekit.useOHmDNS.label = Use openHAB mDNS service io.config.homekit.useOHmDNS.description = Defines whether mDNS service of openHAB or a separate instance of mDNS should be used. +io.config.homekit.listenToNetworkChanges.label = Listen to network changes +io.config.homekit.listenToNetworkChanges.description = Listen to changes on the network interface, e.g. changing of IP address, and restart HomeKit bridge.