serial-scale-bench
Python driver for RS-232/USB commercial bench scales (Kern, Mettler-Toledo, etc.).
Supports two ASCII response protocols:
- Protocol 1 — multi-line header responses (
GS,NT,GTprefixes); typical of Kern and similar label-printing scales - Protocol 2 — single float line; minimal scales and simpler firmware
Protocol is auto-detected on first connection. A FastAPI HTTP server is included for running the scale as a networked service (e.g. LabWatch integration).
Install
Base (serial only):
pip install serial-scale-bench
With HTTP API server:
pip install "serial-scale-bench[api]"
Or editable from this repo:
pip install -e .
Usage
from serial_scale_bench import SerialScale
scale = SerialScale(port="/dev/ttyUSB0", baudrate=9600)
scale.tare()
weight = scale.get_weight() # float grams or None
scale.close()
Auto-reconnect wrapper
from serial_scale_bench import AutoReconnectSerialScale
scale = AutoReconnectSerialScale(port="/dev/ttyUSB0")
weight = scale.get_weight() # reconnects automatically on error
HTTP API server
Start a local REST server exposing the scale over HTTP:
python -m serial_scale_bench.entrypoint --device /dev/ttyUSB0 --port 8080 --scale-id bench1
Endpoints: GET /weight, POST /tare, POST /zero, GET /status, GET /ping.
API reference
| Method | Description |
|---|---|
get_weight() |
Poll current weight (float or None) |
tare() |
Send tare command |
zero() |
Send zero command |
set_tare_value(value) |
Set absolute tare |
is_connected() |
True if serial port is open |
is_responsive() |
True if scale responds to ping |
close() |
Close serial connection |
murineshiftwork integration
Planned: BenchScaleAdapter in murineshiftwork.logic.scale. Install with:
pip install "murineshiftwork[calibration]"
Metadata
Release files for serial-scale-bench 0.2.5
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 |
|---|---|---|---|---|
| serial_scale_bench-0.2.5.tar.gz | 10.6 kB | Without provenance | Details for serial_scale_bench-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| serial_scale_bench-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for serial_scale_bench-0.2.5-py3-none-any.whl |
Total release size: 22.0 kB
Release files / serial_scale_bench-0.2.5.tar.gz
| Download URL | serial_scale_bench-0.2.5.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdabe468a97bc0ecec186b87f0b5aceb4fa34dbda226ad88bfa2d3aaa57d67cf
|
|
BLAKE2b-256 checksum How to use checksums |
3f4d583a6866decc267f8588034c3cc2587cb26d3a2fd4d55f250d833828f372
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / serial_scale_bench-0.2.5-py3-none-any.whl
| Download URL | serial_scale_bench-0.2.5-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ef9907139725e5ed2330a70c88b149eb1858a2f0b99e2268ac3c3f2b0770c35
|
|
BLAKE2b-256 checksum How to use checksums |
8c06fcdd9ea61b0c23e3b124548f482015de1a1596df06ac676a5bba8e3c9faf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.27 {"installer":{"name":"uv","version":"0.11.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for serial-scale-bench 0.2.5
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.