\r
This binding only supports one thing type:\r
\r
-| Thing | Thing Type | Description |\r
-|-------------|------------|---------------------------------------------|\r
+| Thing | Thing Type | Description |\r
+|-------|------------|----------------------------------------|\r
| cvlan | Thing | Represents a single ekey converter UDP |\r
\r
## Thing Configuration\r
\r
The binding uses the following configuration parameters.\r
\r
-| Parameter | Description |\r
-|-----------|----------------------------------------------------------------|\r
-| ipAddress | IPv4 address of the eKey udp converter. A static IP address is recommended.|\r
-| port | The port as configured during the UDP Converter configuration. e.g. 56000 (Binding default) |\r
-| protocol | Can be RARE, MULTI or HOME depending on what the system supports. Binding defaults to RARE |\r
-| delimiter | The delimiter is also defined on the ekey UDP converter - use the ekey configuration software to determine which delimiter is used or to change it. Binding default is `_` (underscore) |\r
+| Parameter | Description |\r
+|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\r
+| ipAddress | IPv4 address of the eKey udp converter. A static IP address is recommended. |\r
+| port | The port as configured during the UDP Converter configuration. e.g. 56000 (Binding default) |\r
+| protocol | Can be RARE, MULTI or HOME depending on what the system supports. Binding defaults to RARE |\r
+| delimiter | The delimiter is also defined on the ekey UDP converter - use the ekey configuration software to determine which delimiter is used or to change it. Binding default is `_` (underscore) |\r
+| natIp | [Optional] IPv4 address of a received eKey udp packet. Can be different from the ipAddress when using NAT. (e.g. in Kubernetes) |\r
\r
## Channels\r
\r
| action | Number | R/M/H | This indicates whether access was granted (value=0) or denied (value=-1). | 0,-1 (136 and 137 with RARE protocol |\r
| fingerId | Number | R/M/H | This indicates the finger that was used by a person. | 0-9,-1 |\r
| fsName | String | M | This returns the 4-character-long name that was specified on the controller for the specific terminals. | |\r
-| fsSerial | Number | R/M/H | This returns the serial number for the specific terminal. |\r
+| fsSerial | Number | R/M/H | This returns the serial number for the specific terminal. | |\r
| inputId | Number | M | This indicates which of the four digital inputs was triggered. Value is number of Input. "-1" indicates that no input was triggered. | 0-4,-1 |\r
| keyId | Number | M | This indicates which of the four keys was used. See ekey documentation on "keys". | 0-4,-1 |\r
| relayId | Number | R/H | This indicates which relay has been switched. | 0-3,-1 |\r
package org.openhab.binding.ekey.internal;
import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.eclipse.jdt.annotation.Nullable;
/**
* The {@link EkeyConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Hans-Jörg Merk - Initial contribution
+ * @author Robert Delbrück - Add natIp
*/
@NonNullByDefault
public class EkeyConfiguration {
public int port;
public String protocol = "";
public String delimiter = "";
+ public @Nullable String natIp;
}
lastPacket = packet.getData();
readMessage(lastPacket);
} else {
- logger.warn("Packet received from unknown source- {}", packet.getData());
+ logger.warn("Packet received from unknown source (ip={}) - {}",
+ packet.getAddress().getHostAddress(), packet.getData());
}
} catch (UnknownHostException e) {
logger.debug("Exception during address conversion - {}", e.getMessage());
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import java.util.Optional;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.NonNullByDefault;
* sent to one of the channels.
*
* @author Hans-Jörg Merk - Initial contribution
+ * @author Robert Delbrück - Add natIp
*/
@NonNullByDefault
public class EkeyHandler extends BaseThingHandler implements EkeyPacketListener {
populateChannels(config.protocol);
String readerThreadName = "OH-binding-" + getThing().getUID().getAsString();
- EkeyUdpPacketReceiver localReceiver = receiver = new EkeyUdpPacketReceiver(config.ipAddress,
- config.port, readerThreadName);
+ EkeyUdpPacketReceiver localReceiver = receiver = new EkeyUdpPacketReceiver(
+ Optional.ofNullable(config.natIp).orElse(config.ipAddress), config.port, readerThreadName);
localReceiver.addEkeyPacketListener(this);
try {
localReceiver.openConnection();
thing-type.config.ekey.protocol.description = Can be RARE, MULTI or HOME depending on what the system supports
thing-type.config.ekey.delimiter.label = Delimiter
thing-type.config.ekey.delimiter.description = The delimiter is also defined on the ekey UDP converter - use the ekey configuration software to determine which delimiter is used or to change it. Another option is _ (underscore)
+thing-type.config.ekey.natIp.label = NAT IP
+thing-type.config.ekey.natIp.description = NAT rewritten source IPv4 address of a received eKey udp packet. Can be different from the ipAddress when using NAT. (e.g. in Kubernetes)
# channel types
channel-type.ekey.userId.label = User ID
<description>@text/thing-type.config.ekey.delimiter.description</description>
<default>_</default>
</parameter>
+ <parameter name="natIp" type="text" required="false">
+ <context>network-address</context>
+ <label>@text/thing-type.config.ekey.natIp.label</label>
+ <description>@text/thing-type.config.ekey.natIp.description</description>
+ </parameter>
</config-description>
</thing-type>