Skip to main content

pro-os-connect-py

Python library and command-line tool for monitoring and controlling Donaldson BOFA fume extractors over the Pro OS Connect TCP protocol.

  • Read telemetry: flow rate, filter pressures, blockage levels, alarms, pump state
  • Start and stop the pump, change the setpoint
  • Read and set the device clock
  • Query device information: software version, serial numbers, network configuration
  • No dependencies beyond crccheck

Disclaimer

The initial working version of this library was written by a human. It was then refactored and improved with the help of Claude Code.

Installation

pip install pro-os-connect-py

Requires Python 3.10 or newer. The device must be reachable on TCP port 2345.

Command-line tool

pro-os-connect-cli --device bofa.local get_telemetry
timestamp=109951839
alarms=0
setpoint=370
flow_rate=9.2
combined_pressure=12.5
pre_pressure=11.1
inlet_pressure=15.4
pump_level=0
real_combined_blockage=0
real_pre_blockage=0
real_inlet_blockage=0
compensated_combined_blockage=0
compensated_pre_blockage=0
is_running=0

Commands

Command Description
get_telemetry All telemetry fields
get_setpoint Current target flow rate
set_setpoint VALUE Set the target flow rate (0–4294967295) and print the new value read back from the device
is_running 1 if the pump is running, 0 otherwise
pump_start Start the pump
pump_stop Stop the pump
get_uptime Device uptime in seconds
get_time Device clock
set_time Set the device clock to this computer's local time
get_software_version Firmware version
get_serial_number Device serial number
get_cpu_serial_number CPU serial number (hex)
get_network_configuration Network configuration
get_protocol_version Pro OS Connect protocol version
echo [--payload TEXT] Check connectivity and measure the round-trip time
reboot Reboot the device

Options

Option Description
--version Library version
-d, --device HOST Hostname or IP address of the device (required)
-j, --json Output JSON instead of text
-p, --precision N Decimal places for telemetry values (default: 1)
-l, --log-level LEVEL Log to stderr at ERROR, WARNING, INFO or DEBUG (DEBUG shows raw packets)

Global options go before the command:

pro-os-connect-cli -d bofa.local --json get_time
{
  "time": "2026-11-09T16:14:04"
}

In JSON mode, commands that return a single value use the command name without its get_/is_ prefix as the key ({"time": ...}, {"running": false}), and commands that perform an action return {"success": true}. Errors are written as {"success": false, "error": "..."}. In text mode, errors go to stderr.

Exit codes

Code Meaning
0 Success
2 Invalid command-line arguments
5 Request error: the connection failed or the device did not respond in time
6 Response error: the response was invalid, was for a different command, could not be decoded, or reported an error status
7 Internal error: the library can't decode the response to its own request (a bug in the library)
8 Other client error
9 Command failed: invalid command, incorrect echo response

Library

from pro_os_connect import ProOSConnect, ProOSConnectError

try:
    with ProOSConnect("bofa.local") as poc:
        telemetry = poc.get_telemetry()
        print(f"Flow rate: {telemetry.flow_rate:.1f}, running: {telemetry.is_running}")

        setpoint = poc.set_setpoint(300)
        print(f"Setpoint set to {setpoint}")
        poc.pump_start()
except ProOSConnectError as e:
    print(f"Device error: {e}")

ProOSConnect(host, port=2345, timeout=2.0, keep_connection=True) connects on the first request and keeps the connection open for later requests until disconnect() is called, or until the with block exits. If a request fails, the connection is closed and the next request opens a new one. Without a with block, call disconnect() when done, e.g. in a finally: clause.

The device accepts only one connection at a time. With keep_connection=False, the client connects for each request and disconnects right after it, so other clients can connect in between. To send several requests over one connection anyway, use hold_connection():

poc = ProOSConnect("bofa.local", keep_connection=False)
with poc.hold_connection():
    telemetry = poc.get_telemetry()
    clock = poc.get_time()
# Disconnected here

The connection is opened by the first request in the block and closed when the block exits. Blocks can be nested. With keep_connection=True, hold_connection() has no effect.

Methods

Method Returns
get_telemetry() TelemetryFields
get_uptime() int, seconds
is_running() bool
pump_start(), pump_stop() None
get_setpoint() int
set_setpoint(setpoint: int, read_back: bool = True) int | None, the new setpoint as read from the device if read_back=True, or None
get_time() datetime
set_time(date_obj: datetime) None; sent without fractional seconds or time zone
get_software_version() str
get_serial_number() str
get_cpu_serial_number() str, hex
get_network_configuration() dict
get_protocol_version() int
echo(test_payload: bytes | None = None) bool, whether the device sent the payload back unchanged
reboot() None
connect(force=False), disconnect() Manage the connection explicitly
with ProOSConnect(...) as poc: Context manager: disconnect when the block exits
hold_connection() Context manager: keep one connection open for the requests in the block

Errors are raised as exceptions (see below), so methods that only perform an action return None.

TelemetryFields is a dataclass with these fields:

Field Type Notes
timestamp int Device uptime in hundredths of a second
alarms int Alarm flags (bit map)
setpoint int Target flow rate [m³/h]
flow_rate float Actual flow rate [m³/h]
combined_pressure, pre_pressure, inlet_pressure float [Pa]
pump_level int Drive level (0 - 1000)
real_combined_blockage, real_pre_blockage, real_inlet_blockage int [%]
compensated_combined_blockage, compensated_pre_blockage int Blockage of the combined filter/pre-filter after accounting for the expected pressure drop across a new filter [%]
is_running bool Whether the pump is running

Errors

Errors communicating with the device derive from ProOSConnectError:

ProOSConnectError
├── ProOSConnectRequestError      sending the request failed
│   ├── ProOSConnectConnectError  connection refused, timed out, closed or broken
│   └── ProOSConnectTimeoutError  request not sent or no response within the timeout
├── ProOSConnectResponseError     invalid or mismatched response, undecodable payload
│   └── ProOSConnectStatusError   the device responded with an error status
└── ProOSConnectInternalError     a bug in the library: no decoder for the response to its request

ProOSConnectStatusError.status is the StatusCode the device sent, for example to tell a device configured as read-only from a rejected argument:

from pro_os_connect import ProOSConnectStatusError, StatusCode

try:
    poc.set_setpoint(300)
except ProOSConnectStatusError as e:
    if e.status is StatusCode.WRITE_PROTECTED:
        print("The device is read-only")
    else:
        raise

Invalid arguments raise TypeError (wrong type, including bool where an int is expected) or ValueError (out of range, e.g. a negative setpoint) before anything is sent, and leave the connection untouched. They are bugs in the calling code, not device errors, so they don't derive from ProOSConnectError.

Thread safety

The ProOSConnect instance isn't thread-safe: two threads sharing one client could interleave requests on the same socket.

Public API

The public API, covered by semantic versioning, is what pro_os_connect exports in __all__: ProOSConnect with the methods and constructor arguments documented above, the exceptions, StatusCode, TelemetryFields, TCP_PORT and __version__. Everything else, including send_request(), the request, response, codecs and common modules, and attributes such as socket, is internal and may change in any release.

Protocol notes

The device's payload checksum is CRC-32/MPEG-2 computed over the data zero-padded to a multiple of 4 bytes, as a 32-bit hardware CRC unit would compute it. A standard CRC-32/MPEG-2 only matches when the length is already a multiple of 4. The device silently ignores requests with any other checksum.

Development

uv sync
uv run pytest

The tests do not need a device: they run against a simulated device on localhost.

License

MIT

Metadata

Release files for pro-os-connect-py 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pro-os-connect-py 1.0.0
File Size Uploaded Provenance Actions
pro_os_connect_py-1.0.0.tar.gz 17.8 kB With provenance Details for pro_os_connect_py-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pro-os-connect-py 1.0.0
File Interpreter ABI Platform Actions
pro_os_connect_py-1.0.0-py3-none-any.whl Python 3 none any Details for pro_os_connect_py-1.0.0-py3-none-any.whl

Total release size: 38.4 kB

Release files / pro_os_connect_py-1.0.0.tar.gz

Download URL pro_os_connect_py-1.0.0.tar.gz
Size 17.8 kB
Tags Source
SHA-256 checksum
How to use checksums
bfc193c84b6bc8b1f78f08ec08a848ae4582e2a818a122477b037e64fc91f70f
BLAKE2b-256 checksum
How to use checksums
7bf22adcd047d09d2bd15603cd4e032e7c4917ae5e6e47c449a39926ac08aaa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Release files / pro_os_connect_py-1.0.0-py3-none-any.whl

Download URL pro_os_connect_py-1.0.0-py3-none-any.whl
Size 20.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b72a66c7fdedc3269b1dfc922bbc02b72543b922ac29d227fd6dcbaceafbf24c
BLAKE2b-256 checksum
How to use checksums
92a4ac7668fdfeff0379213d1c5232b91a6d36cfd7d5eb569334d68b5aa52f88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 24, 2026.

Transparency log

Security for pro-os-connect-py 1.0.0

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.

Select from 2 files

Attestation for pro_os_connect_py-1.0.0.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 Nov 24, 2026.

Transparency log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page