The Generic IP driver turns the gateway into a raw TCP or UDP endpoint, as a client or as a server, with optional TLS. It does not implement any application protocol: every byte received on the socket is exposed as an address value, and every value written to a write address is sent on the socket as-is.
Use it whenever a device or a third-party system speaks a proprietary ASCII or binary protocol over IP that no dedicated driver covers:
TEMP=21.5<LF>) over TCP.SET (\d+)) and extract values from the replies with regular expressions.Generic IP is event-driven: there is no polling and no read-on-demand. Data appears on the addresses as soon as it is received, and a reply to a command you sent simply shows up on the data addresses.
client, and enter the device Host (IPv4) and Port.\n so that one address update corresponds to one complete message.%tcp:_data — everything received%tcp:_write — write here to send%tcp:_status — 1 when connected, 0 otherwiseWrite "GET TEMP\n" to %tcp:_write: the command is sent, and the reply appears on %tcp:_data.
Set Type = server and a Port: the gateway listens on that port for TCP connections (and UDP datagrams if UDP is checked). Writing to %tcp:_write sends to every connected client. Check One address per client to get a dedicated set of addresses for each client IP (see section 3.2).
Add an address named %tcp:data:TEMP=(\d+\.\d+). Each received frame is tested against the regular expression; when it matches, the address takes the value of the capture group, here the string "21.5". This value can be logged, routed and displayed like any other.
| Label | JSON Key | Description |
|---|---|---|
| Name | name | A descriptive name for this gateway instance. |
| Description | description | Optional description of the gateway. |
| Cluster ID | cluster | Process grouping. 0 (default): the gateway runs in its own process. Any other number: the gateway shares one process with the other gateways that have the same number, which saves memory. |
| TCP | json.tcpEnable | Enables the TCP part and creates the %tcp:_data, %tcp:_write and %tcp:_status addresses. Default: true. |
| UDP | json.udpEnable | Enables the UDP part (IPv4) and creates the %udp:_data and %udp:_write addresses. Default: false. At least one of TCP or UDP must be enabled. |
| Type | json.type | client: connects to Host:Port (TCP) or sends datagrams to it (UDP). server: listens on Port. Applies to both TCP and UDP. Default: client. |
| Host | json.host | Remote IPv4 address, client mode only. Hostnames are not accepted. Default: 127.0.0.1. |
| Port | json.port | Remote port (client) or listening port (server), 1 to 65535. TCP and UDP share the same port number. No default: must be set. |
| One address per client | json.separateClients | Server mode only. Creates %tcp:<ip>/_data, %tcp:<ip>/_write and %tcp:<ip>/_status for each connected client (%udp:<ip>/_data and %udp:<ip>/_write for UDP). The broadcast addresses remain. Default: false. |
| Frame separator | json.separator | TCP only. When set, a value is emitted only when a complete frame is received; the separator itself is removed. Empty: data is emitted as it arrives. Escapes \n, \r, \t, \0 and \xHH are supported. Default: empty. |
| TLS | json.tls | Wraps the TCP connection in TLS. UDP is never encrypted. Default: false. |
| Require client certificate | json.requestCert | TLS server mode only. Every client must present a certificate signed by an authority of the ca list, or by the SCEP CA when the list is empty. Connections without a valid certificate are refused. Default: false. |
| SCEP | json.scep | Obtains the certificate and key from a SCEP server and renews them automatically. When checked, the manual ca / key / cert fields are hidden. Default: false. |
| ca | json.ca | Trusted CA certificates (PEM files). Used to verify the remote certificate. A manual list has priority over the SCEP CA. |
| key | json.key | Private key (PEM), when SCEP is not used. |
| cert | json.cert | Certificate (PEM), when SCEP is not used. |
| SCEP URL | json.scepURL | SCEP server endpoint, for example https://pki.example.com/scep. |
| SCEP CN | json.scepCN | Common Name requested for the gateway certificate. |
| SCEP challenge | json.scepChallenge | Challenge password used for enrolment. |
TLS client verification. The server certificate is verified only when a CA is available, either in the ca list or from SCEP. Without a CA, any server certificate is accepted: the link is encrypted but the peer is not authenticated. Always provide a CA for production links.
{
"tcpEnable": true,
"udpEnable": false,
"type": "client",
"host": "192.168.1.50",
"port": 5000,
"tls": false,
"separator": "\\n"
}
Addresses use the %tcp: or %udp: prefix. In the tables below, <ip> and <regex> stand for a value you replace (for example %tcp:10.0.0.12/_data); the angle brackets are not typed. Only the forms below are meaningful; any other name is accepted by the interface but never receives data and cannot be written.
| Address | Created | Role |
|---|---|---|
%tcp:_data |
automatically | Every TCP chunk or frame received (broadcast). |
%tcp:_write |
automatically | Write to send: to the server in client mode, to all connected clients in server mode. |
%tcp:_status |
automatically | Number of open TCP sockets: 0 or 1 in client mode, the client count in server mode. |
%udp:_data |
automatically | One value per received datagram. |
%udp:_write |
automatically | Write to send: to Host:Port in client mode, to every remote peer that already sent a datagram in server mode. |
%tcp:data:<regex> %udp:data:<regex> |
by the user | Pattern read: the regular expression is tested against each received frame (see 3.3). |
%tcp:write:<regex> %udp:write:<regex> |
by the user | Pattern write: the written value fills the capture groups of the regular expression, and the result is sent. |
%tcp:<ip>/_data %tcp:<ip>/_write %tcp:<ip>/_status |
automatically, with One address per client | Per-client variants in server mode. _status counts the sockets coming from that IP. |
%udp:<ip>/_data %udp:<ip>/_write |
automatically, with One address per client | Per-peer variants for UDP. There is no %udp:…/_status. |
%tcp:<ip>/data:<regex> %tcp:<ip>/write:<regex> %udp:<ip>/data:<regex> %udp:<ip>/write:<regex> |
by the user | Pattern addresses restricted to one client or peer IP. |
In server mode, several systems may connect at the same time. With One address per client checked, the driver creates a dedicated set of addresses for each remote IPv4 as soon as it connects (TCP) or sends its first datagram (UDP). Received data is emitted both on the broadcast _data and on the client's <ip>/_data; writing to <ip>/_write reaches only that client. Several clients behind the same NAT share one IP: <ip>/_status then counts their sockets.
Reading. %tcp:data:<regex> is tested against the whole frame, anchored at both ends. The address value is:
( );Frames that do not match are ignored. For example %tcp:data:ID=(\d+);VAL=(.*) turns the frame ID=7;VAL=on into ["7","on"].
The pattern must match the entire frame, including any character left at its end. Without a Frame separator, a line-oriented device delivers
TEMP=21.5\r\n, whichTEMP=(\d+\.\d+)does not match, and one TCP chunk may hold several messages or only part of one. With Frame separator =\nand a device that ends its lines with CR LF, the frame still ends with\r. Set the separator to the full terminator (\r\n) or end the pattern with\s*. UDP datagrams are never split: include the terminator in the pattern.
Extracted values are always strings ("21.5"). Convert them in a route function, for examplefunction(value){ return Number(value) }, when the destination expects a number.
Writing. %tcp:write:<regex> builds the frame from the expression: literal text outside the groups is copied as-is, and each top-level group is replaced by the written value, in order. Writing 42 to %tcp:write:SET (\d+) sends SET 42. For several groups, write an array ([22, 1]) or a bracket string ("[22][1]"). The built frame is checked against the expression; if it does not match, the write fails with built value "…" does not match pattern.
Line terminators are not added for you. The Frame separator is only used to split received data; it is never appended to what you send. Outside the groups, a write pattern may only contain literal text: a backslash escape is copied without its backslash (
\.gives., but\r\ngives the two lettersrnand\sgivess), and other regex syntax such as?,+or[..]is copied literally, so the write fails withbuilt value "…" does not match pattern.
To send a terminated command, either put the terminator in a group,%tcp:write:SET (\d+)(\r\n)written with[42, "\r\n"], or build the whole string in a route function and send it to%tcp:_write:function(value){ return 'SET ' + value + '\r\n' }.
Regular expressions in address names must be valid JavaScript expressions. An invalid read pattern is silently ignored; an invalid write pattern returns
bad pattern.
| Label | JSON Key | Description |
|---|---|---|
| Name | name | The address, with its %tcp: or %udp: prefix. |
| Description | description | Optional description. |
| Extended value | json.extended | On _data addresses, the value is an object { "data": "<frame>", "source": "<ip>:<port>" } by default; uncheck to receive the plain string. On pattern addresses, extended off (the driver default) gives the extracted value and true gives { data, source, groups }. Choose it when you create the address: the checkbox is not shown when you edit an existing pattern address, and the Extended column of the grid can only be edited on _data addresses. To change it later, set "extended" in the address JSON (for example with gateways.updateAddress of the peers API). |
| Log | log | Logging mode: never, on update, always, or a fixed duration. |
| Property | Value |
|---|---|
| Readable | No — the driver has no read method; values arrive when data is received |
| Writable | _write addresses and write: pattern addresses only |
| Routable | Yes — _data, patterns and _status as sources, _write and write: patterns as destinations |
| Loggable | Yes |
Values written to a _write address are converted before sending: objects are serialised as JSON, everything else as a UTF-8 string. The written value is also echoed as the new value of the _write address, so it is visible in the interface. Received bytes are decoded as UTF-8.
How to build the PEM files with openssl, and how SCEP works on the device: see TLS certificates and SCEP.
Check TLS and upload the PEM files: ca to verify the remote side, key and cert to present your own certificate (required in server mode, optional in client mode for mutual TLS). In server mode, Require client certificate refuses any client whose certificate is not signed by an authority of the ca list.
Check SCEP and fill in the SCEP URL, SCEP CN and SCEP challenge. The gateway enrols at start-up, stores the certificate in its data directory, and then:
To pin the SCEP CA, add the JSON-only key scepFingerprint (SHA-256 fingerprint of the CA certificate, hexadecimal): enrolment then fails with CA fingerprint mismatch if the server presents another CA.
The ca field is hidden while SCEP is checked. To combine your own CA list with SCEP, set the ca key in the gateway JSON (API): it then takes priority over the CA returned by the SCEP server.
On renewal, a TLS server swaps its certificate without dropping existing connections; a TLS client restarts to reconnect with the new certificate. Until the first enrolment succeeds, the gateway stays offline and logs scep: no certificate yet.
{ "tcpEnable": true, "udpEnable": false, "type": "client",
"host": "192.168.1.50", "port": 5000, "tls": false, "separator": "\\n" }
| Address | Purpose |
|---|---|
%tcp:_data |
{ "data": "TEMP=21.5", "source": "192.168.1.50:5000" } |
%tcp:data:TEMP=(\d+\.\d+) |
"21.5" (a string) — log it, route it to a BACnet or Modbus address |
%tcp:write:SET (\d+) |
route a setpoint here: writing 42 sends SET 42, without line feed (see 3.3) |
%tcp:_status |
1 while connected, use it in an alert route |
{ "tcpEnable": true, "udpEnable": false, "type": "server", "port": 7000,
"separateClients": true, "tls": true, "requestCert": true,
"scep": true, "scepURL": "https://pki.example.com/scep",
"scepCN": "gateway-01", "scepChallenge": "secret", "separator": "\\r\\n" }
Each authenticated client gets %tcp:<ip>/_data, %tcp:<ip>/_write and %tcp:<ip>/_status. A pattern such as %tcp:10.0.0.12/data:ID=(\d+);VAL=(.*) extracts values from that client only.
{ "tcpEnable": false, "udpEnable": true, "type": "server", "port": 9000 }
%udp:_data receives one value per datagram. Set Extended value off to get the raw string. %udp:_write answers every peer that has already sent something.
_data (and <ip>/_data), then tested against every data: pattern address._write or a write: pattern is sent immediately on the matching sockets._status follows the number of open TCP sockets.In client mode, a closed or refused connection stops the driver, which the gateway restarts after a short delay; _status returns to 0 in the meantime. In server mode, an error on one client socket restarts the whole gateway.
%udp:_write fails with no udp peer until a first datagram has been received.
| Message | Meaning |
|---|---|
no tcp connection (write) |
No TCP socket is open: the client is not connected yet, or no client (or none from the targeted IP) is connected to the server. |
udp not started (write) |
No UDP socket is open: UDP is not enabled, or the gateway has not started it yet. |
no udp peer (write) |
UDP server mode: no datagram has been received yet from a peer (or from the targeted IP). |
not a writable address (write) |
The address is neither _write nor a write: pattern. |
no value (write) |
The written value is null or undefined. |
built value "…" does not match pattern (write) |
The frame built from the pattern does not match it, see 3.3. |
neither tcp nor udp enabled |
TCP and UDP are both unchecked. |
tcp frame separator not found within 1MB |
The Frame separator never appears in the stream: check it against the real terminator. |
connection closed |
Client mode: the remote side closed the connection; the gateway restarts and reconnects. |
Lines starting with >>GENERICIP |
Traces of normal activity (listening, socket connected, write…). They are logged at error level but are not errors by themselves. |