mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 15:11:59 +01:00
[network] Add configuration parameter for using iOS wake-up (#16259)
Fixes #9575 Signed-off-by: Leo Siepel <leosiepel@gmail.com> Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
parent
b701dd0cc6
commit
2ee995afed
@ -53,6 +53,7 @@ Use the following options for a **network:pingdevice**:
|
|||||||
- **retry:** After how many refresh interval cycles the device will be assumed to be offline. Default: `1`.
|
- **retry:** After how many refresh interval cycles the device will be assumed to be offline. Default: `1`.
|
||||||
- **timeout:** How long the ping will wait for an answer, in milliseconds. Default: `5000` (5 seconds).
|
- **timeout:** How long the ping will wait for an answer, in milliseconds. Default: `5000` (5 seconds).
|
||||||
- **refreshInterval:** How often the device will be checked, in milliseconds. Default: `60000` (one minute).
|
- **refreshInterval:** How often the device will be checked, in milliseconds. Default: `60000` (one minute).
|
||||||
|
- **useIOSWakeUp:** When set to true, an additional port knock is performed before a ping. Default: `true`.
|
||||||
- **networkInterfaceNames:** The network interface names used for communicating with the device.
|
- **networkInterfaceNames:** The network interface names used for communicating with the device.
|
||||||
Limiting the network interfaces reduces the load when arping and Wake-on-LAN are used.
|
Limiting the network interfaces reduces the load when arping and Wake-on-LAN are used.
|
||||||
Use comma separated values when using textual config. Default: empty (all network interfaces).
|
Use comma separated values when using textual config. Default: empty (all network interfaces).
|
||||||
@ -91,8 +92,7 @@ Use DHCP listen for an almost immediate presence detection for phones and tablet
|
|||||||
|
|
||||||
Apple iOS devices are usually in a deep sleep mode and do not respond to ARP pings under all conditions, but to Bonjour service discovery messages (UDP port 5353).
|
Apple iOS devices are usually in a deep sleep mode and do not respond to ARP pings under all conditions, but to Bonjour service discovery messages (UDP port 5353).
|
||||||
Therefore, first a Bonjour message is sent, before the ARP presence detection is performed.
|
Therefore, first a Bonjour message is sent, before the ARP presence detection is performed.
|
||||||
The binding automatically figures out if the target device is an iOS device.
|
This is default behaviour of the binding, when needed this can be changed with the config parameter `useIOSWakeUp`.
|
||||||
To check if the binding has correctly recognised a device, have a look at the _uses_ios_wakeup_ property of the Thing.
|
|
||||||
|
|
||||||
### Use open TCP ports
|
### Use open TCP ports
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ Things support the following channels:
|
|||||||
demo.things:
|
demo.things:
|
||||||
|
|
||||||
```java
|
```java
|
||||||
Thing network:pingdevice:devicename [ hostname="192.168.0.42", macAddress="6f:70:65:6e:48:41" ]
|
Thing network:pingdevice:devicename [ hostname="192.168.0.42", macAddress="6f:70:65:6e:48:41", useIOSWakeUp="false" ]
|
||||||
Thing network:speedtest:local "SpeedTest 50Mo" @ "Internet" [url="https://bouygues.testdebit.info/", fileName="50M.iso"]
|
Thing network:speedtest:local "SpeedTest 50Mo" @ "Internet" [url="https://bouygues.testdebit.info/", fileName="50M.iso"]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -60,5 +60,4 @@ public class NetworkBindingConstants {
|
|||||||
public static final String PROPERTY_ARP_STATE = "arp_state";
|
public static final String PROPERTY_ARP_STATE = "arp_state";
|
||||||
public static final String PROPERTY_ICMP_STATE = "icmp_state";
|
public static final String PROPERTY_ICMP_STATE = "icmp_state";
|
||||||
public static final String PROPERTY_PRESENCE_DETECTION_TYPE = "presence_detection_type";
|
public static final String PROPERTY_PRESENCE_DETECTION_TYPE = "presence_detection_type";
|
||||||
public static final String PROPERTY_IOS_WAKEUP = "uses_ios_wakeup";
|
|
||||||
}
|
}
|
||||||
|
@ -31,5 +31,6 @@ public class NetworkHandlerConfiguration {
|
|||||||
public Integer retry = 1;
|
public Integer retry = 1;
|
||||||
public Integer refreshInterval = 60000;
|
public Integer refreshInterval = 60000;
|
||||||
public Integer timeout = 5000;
|
public Integer timeout = 5000;
|
||||||
|
public boolean useIOSWakeUp = true;
|
||||||
public Set<String> networkInterfaceNames = Set.of();
|
public Set<String> networkInterfaceNames = Set.of();
|
||||||
}
|
}
|
||||||
|
@ -184,11 +184,7 @@ public class NetworkHandler extends BaseThingHandler
|
|||||||
}
|
}
|
||||||
presenceDetection.setServicePorts(Set.of(port));
|
presenceDetection.setServicePorts(Set.of(port));
|
||||||
} else {
|
} else {
|
||||||
// It does not harm to send an additional UDP packet to a device,
|
presenceDetection.setIOSDevice(handlerConfiguration.useIOSWakeUp);
|
||||||
// therefore we assume all ping devices are iOS devices. If this
|
|
||||||
// does not work for all users for some obscure reason, we can make
|
|
||||||
// this a thing configuration variable.
|
|
||||||
presenceDetection.setIOSDevice(true);
|
|
||||||
// Hand over binding configurations to the network service
|
// Hand over binding configurations to the network service
|
||||||
presenceDetection.setUseDhcpSniffing(configuration.allowDHCPlisten);
|
presenceDetection.setUseDhcpSniffing(configuration.allowDHCPlisten);
|
||||||
presenceDetection.setUseIcmpPing(configuration.allowSystemPings);
|
presenceDetection.setUseIcmpPing(configuration.allowSystemPings);
|
||||||
@ -214,7 +210,6 @@ public class NetworkHandler extends BaseThingHandler
|
|||||||
properties.put(NetworkBindingConstants.PROPERTY_ARP_STATE, presenceDetection.getArpPingState());
|
properties.put(NetworkBindingConstants.PROPERTY_ARP_STATE, presenceDetection.getArpPingState());
|
||||||
properties.put(NetworkBindingConstants.PROPERTY_ICMP_STATE, presenceDetection.getIPPingState());
|
properties.put(NetworkBindingConstants.PROPERTY_ICMP_STATE, presenceDetection.getIPPingState());
|
||||||
properties.put(NetworkBindingConstants.PROPERTY_PRESENCE_DETECTION_TYPE, "");
|
properties.put(NetworkBindingConstants.PROPERTY_PRESENCE_DETECTION_TYPE, "");
|
||||||
properties.put(NetworkBindingConstants.PROPERTY_IOS_WAKEUP, presenceDetection.isIOSdevice() ? "Yes" : "No");
|
|
||||||
properties.put(NetworkBindingConstants.PROPERTY_DHCP_STATE, presenceDetection.getDhcpState());
|
properties.put(NetworkBindingConstants.PROPERTY_DHCP_STATE, presenceDetection.getDhcpState());
|
||||||
updateProperties(properties);
|
updateProperties(properties);
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,8 @@ thing-type.config.network.pingdevice.retry.label = Retry
|
|||||||
thing-type.config.network.pingdevice.retry.description = How many refresh interval cycles should a presence detection should take place, before the device is stated as offline
|
thing-type.config.network.pingdevice.retry.description = How many refresh interval cycles should a presence detection should take place, before the device is stated as offline
|
||||||
thing-type.config.network.pingdevice.timeout.label = Timeout
|
thing-type.config.network.pingdevice.timeout.label = Timeout
|
||||||
thing-type.config.network.pingdevice.timeout.description = States how long to wait for a response (in ms), before if a device is stated as offline
|
thing-type.config.network.pingdevice.timeout.description = States how long to wait for a response (in ms), before if a device is stated as offline
|
||||||
|
thing-type.config.network.pingdevice.useIOSWakeUp.label = Use iOS Wake Up
|
||||||
|
thing-type.config.network.pingdevice.useIOSWakeUp.description = Set to true if the device presence detection should be performed for an iOS device like iPhone or iPads. An additional port knock is performed before a ping.
|
||||||
thing-type.config.network.servicedevice.hostname.label = Hostname or IP
|
thing-type.config.network.servicedevice.hostname.label = Hostname or IP
|
||||||
thing-type.config.network.servicedevice.hostname.description = Hostname or IP of the device
|
thing-type.config.network.servicedevice.hostname.description = Hostname or IP of the device
|
||||||
thing-type.config.network.servicedevice.macAddress.label = MAC Address
|
thing-type.config.network.servicedevice.macAddress.label = MAC Address
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
<property name="dhcp_state">-</property>
|
<property name="dhcp_state">-</property>
|
||||||
<property name="icmp_state">-</property>
|
<property name="icmp_state">-</property>
|
||||||
<property name="presence_detection_type">-</property>
|
<property name="presence_detection_type">-</property>
|
||||||
<property name="uses_ios_wakeup">-</property>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<config-description>
|
<config-description>
|
||||||
@ -62,6 +61,15 @@
|
|||||||
reduces the load when arping and Wake-on-LAN are used. All interfaces are used when left empty.</description>
|
reduces the load when arping and Wake-on-LAN are used. All interfaces are used when left empty.</description>
|
||||||
<advanced>true</advanced>
|
<advanced>true</advanced>
|
||||||
</parameter>
|
</parameter>
|
||||||
|
|
||||||
|
<parameter name="useIOSWakeUp" type="boolean" required="true">
|
||||||
|
<label>Use iOS Wake Up</label>
|
||||||
|
<default>true</default>
|
||||||
|
<description>Set to true if the device presence detection should be performed for an iOS device like iPhone or
|
||||||
|
iPads. An additional port knock is performed before a ping.</description>
|
||||||
|
<advanced>true</advanced>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
</config-description>
|
</config-description>
|
||||||
</thing-type>
|
</thing-type>
|
||||||
|
|
||||||
@ -82,7 +90,6 @@
|
|||||||
<property name="dhcp_state">-</property>
|
<property name="dhcp_state">-</property>
|
||||||
<property name="icmp_state">-</property>
|
<property name="icmp_state">-</property>
|
||||||
<property name="presence_detection_type">-</property>
|
<property name="presence_detection_type">-</property>
|
||||||
<property name="uses_ios_wakeup">-</property>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<config-description>
|
<config-description>
|
||||||
|
Loading…
Reference in New Issue
Block a user