BLE Nordic UART Service (NUS) client — interactive terminal and PTY bridge
Project description
nus-client
BLE Nordic UART Service (NUS) client for interactive terminals and PTY bridging.
Connect to any BLE peripheral that exposes the standard Nordic UART Service and interact with it from your terminal — or expose the connection as a pseudo-terminal (PTY) device so third-party tools (minicom, screen, picocom, or any serial library) can talk to it like a local serial port.
Installation
pip install nus-client
From source
git clone https://github.com/will-tm/nus-client.git
cd nus-client
pip install -e ".[dev]"
Quick start
Scan for nearby BLE devices
nus-client --scan
Devices exposing NUS are marked with *.
Interactive terminal
# Auto-connect to the first NUS peripheral found
nus-client
# Connect by name
nus-client --name "My Device"
# Connect by Bluetooth address
nus-client --addr E8:C1:C7:11:22:33
# Filter by name prefix
nus-client --prefix "Sensor"
Each keystroke is sent as a BLE write; the remote device's responses print to stdout. Press Ctrl-] to disconnect.
PTY bridge
nus-client --pty
This creates a pseudo-terminal and prints its path (e.g. /dev/ttys005). Any tool that speaks serial can open that path:
# In another terminal
screen /dev/ttys005
# or
minicom -D /dev/ttys005
# or from Python
import serial
ser = serial.Serial("/dev/ttys005")
The PTY path is also printed to stdout (status messages go to stderr), so scripts can capture it:
PTY=$(nus-client --pty 2>/dev/null)
CLI reference
usage: nus-client [-h] [--version] [--name NAME] [--addr ADDR]
[--prefix PREFIX] [--scan] [--pty] [--timeout TIMEOUT]
options:
--name NAME match peripheral by exact advertised name
--addr ADDR match peripheral by Bluetooth address
--prefix PREFIX match peripherals whose name starts with PREFIX
--scan list visible peripherals and exit
--pty expose the connection as a PTY instead of interactive mode
--timeout TIMEOUT scan timeout in seconds (default: 12)
How it works
nus-client uses SimplePyBLE to communicate over Bluetooth Low Energy. The Nordic UART Service is a de-facto standard (UUID 6e400001-b5a3-f393-e0a9-e50e24dcca9e) implemented by Nordic nRF SDKs, Zephyr, and many custom firmware stacks.
- RX characteristic (
6e400002-...): host writes data here (sent to the peripheral) - TX characteristic (
6e400003-...): peripheral sends notifications here (received by the host)
In interactive mode, the terminal is set to raw mode and keystrokes are forwarded over BLE. In PTY mode, a pseudo-terminal pair is created — the master side is bridged to BLE, and the slave path is exposed for external tools.
Platform support
| Platform | Interactive | PTY |
|---|---|---|
| macOS | Yes | Yes |
| Linux | Yes | Yes |
| Windows | Yes | No |
PTY mode is not available on Windows because it relies on POSIX pseudo-terminals (openpty). Interactive mode works on Windows using msvcrt.
Development
pip install -e ".[dev]"
# Lint
ruff check src/ tests/
# Type check
mypy src/
# Test
pytest
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nus_client-0.1.1.tar.gz.
File metadata
- Download URL: nus_client-0.1.1.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f1c71ad8a5b2544487ef911d387f8fc0c26952b3b514ce6a4177d1bfd2d1a35
|
|
| MD5 |
9e4d21c06776e0038f578c57e49de385
|
|
| BLAKE2b-256 |
70d674b4646ca408b60a37210cbde910a08012190ca16f406ea0b1a1e67a883c
|
File details
Details for the file nus_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nus_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f2b078a82400ada61fc30a9e2b6816125b0176b30c778454eff8719c9233ed3
|
|
| MD5 |
7ca5f161070f85a00fb1041912060e18
|
|
| BLAKE2b-256 |
d423f5d01f990a0bd56163486f6a13be9b07452752745df05433f616c02bcd10
|