UART2MQTT
A minimal Python bridge that connects USB UART devices to MQTT topics. It automatically discovers USB serial devices, filters them using a VID:PID allow list, and creates bidirectional communication between each serial port and its associated MQTT topic.
Features
- Automatically detects serial devices via
/dev/serial/by-path - Filters devices using VID/PID from
/sys/class/tty/... - Bidirectional communication between UART and MQTT
- Dynamic topic generation:
<topic_base>/<port>/device_serial_output - Configurable via a TOML file at
/etc/uart2mqtt.toml
Configuration
Create /etc/uart2mqtt.toml:
[mqtt]
host = "mqtt-broker.local"
port = 1883
topic_base = "testbench"
# USB match sections are optional. If specified, it only matches with
# listed vid:pids. Can list [[usb_match]] multiple times, and can use "*" as
# wilcards.
[[usb_match]]
vid = "1a86"
pid = "7523"
# If no usb_match is specified, all devices are matched similar to this:
[[usb_match]]
vid = "*"
pid = "*"
Usage
Run the bridge:
uart2mqtt
See the example "uart2mqtt.service" example file as well. Update it to include the user this will run as, then:
cp /uart2mqtt.service /etc/systemd/system/uart2mqtt.service
systemctl --now enable uart2mqtt.service
Requirements
- Python 3.11+
pyserialpaho-mqtt
Development Setup:
After cloning, install the git pre-commit hooks.
# Run once:
pre-commit install
# To run by hand before a commit
pre-commit run --all-files
License
MIT
Metadata
Release files for uart2mqtt 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| uart2mqtt-0.1.2.tar.gz | 9.4 kB | With provenance | Details for uart2mqtt-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| uart2mqtt-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for uart2mqtt-0.1.2-py3-none-any.whl |
Total release size: 16.2 kB
Release files / uart2mqtt-0.1.2.tar.gz
| Download URL | uart2mqtt-0.1.2.tar.gz |
|---|---|
| Size | 9.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b2215863e35b68907519799b9a9a762caf2028688b40e74a6358ce67dbffdd3
|
|
BLAKE2b-256 checksum How to use checksums |
f18569bce8bd857e9acd720c1dee84f6c32497c57c4bdaa9a4d153fb323cdab6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2025.
Transparency logRelease files / uart2mqtt-0.1.2-py3-none-any.whl
| Download URL | uart2mqtt-0.1.2-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97ab3e2fc6a66c279a465b6026b649bef74371040349320a61b777d32fb50514
|
|
BLAKE2b-256 checksum How to use checksums |
7c13fa624b97f54e366453f97170d64f8d0a04acab0de1b662a30c1a00166477
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2025.
Transparency logSecurity for uart2mqtt 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for uart2mqtt-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 19, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.