Skip to content

Commit

Permalink
docs: document serial-over-tcp connections (zwave-js#3762)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCalzone authored Nov 19, 2021
1 parent aa209c7 commit b66f221
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

- [Send custom messages](usage/custom.md)
- [External config DB location](usage/external-config.md)
- [Connect to a hosted serial port over TCP](usage/tcp-connection.md)

- Troubleshooting

Expand Down
1 change: 1 addition & 0 deletions docs/api/CCs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@

- [Send custom messages](usage/custom.md)
- [External config DB location](usage/external-config.md)
- [Connect to a hosted serial port over TCP](usage/tcp-connection.md)

- Troubleshooting

Expand Down
2 changes: 1 addition & 1 deletion docs/api/driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The driver is the core of this library. It controls the serial interface, handle
new (port: string, options?: ZWaveOptions) => Driver
```

The first constructor argument is the address of the serial port. On Windows, this is similar to `"COM3"`. On Linux this has the form `/dev/ttyAMA0` (or similar). Alternatively, you can connect to a serial port that is hosted over TCP (for example with the `ser2net` utility). In this case, use `tcp://<hostname>:<portnumber>` as the connection string. If you're using `ser2net`, use these settings to host the port: `<portnumber>:raw:0:<path-to-serial>:115200 8DATABITS NONE 1STOPBIT`.
The first constructor argument is the address of the serial port. On Windows, this is similar to `"COM3"`. On Linux this has the form `/dev/ttyAMA0` (or similar). Alternatively, you can connect to a serial port that is hosted over TCP (for example with the `ser2net` utility), see [Connect to a hosted serial port over TCP](usage/tcp-connection.md).

For more control, the constructor accepts an optional options object as the second argument. See [`ZWaveOptions`](#ZWaveOptions) for a detailed desription.

Expand Down
24 changes: 24 additions & 0 deletions docs/usage/tcp-connection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Connect to a hosted serial port over TCP

Instead of using a local serial port, the driver can connect to a serial port hosted on a remote server via TCP, for example using [`ser2net`](https://linux.die.net/man/8/ser2net).

To do so, enter `tcp://<hostname-or-ip>:<port>` as the connection string, where

- `<hostname-or-ip>` is the hostname or IP address of the remote server
- and `<port>` is the port number under which the serial port is accessible.

The serial port must be configured with the following settings:

- raw, no timeout
- baudrate: 115200
- data bits: 8
- parity: none
- stop bits: 1

If using `ser2net`, this corresponds to the following settings:

```
<port>:raw:0:<path-to-serial>:115200 8DATABITS NONE 1STOPBIT
```

where `<path-to-serial>` is the path to the serial port on the remote server and `<port>` is the port number used in the connection string.

0 comments on commit b66f221

Please sign in to comment.