flexit-modbus Python library
flexit-modbus is an asynchronous Python library for reading from and
writing to a Flexit air handling unit fitted with a CI66 Modbus adapter
over Modbus.
Purpose and scope of this library
The library flexit-modbus:
- is intended for operational monitoring and basic control (target temperature, fan speed) of an already commissioned Flexit unit. It does NOT attempt to reproduce every menu, parameter, or register the unit supports — only the datapoints exposed by the CI66 adapter's Modbus map that are useful for day-to-day monitoring and control.
- contains the CI66 adapter's data model. It knows the available holding and input registers, their data types and metadata, and the rules required for safe reads and writes (e.g. the 10-30 °C setpoint range).
- does NOT create or own the Modbus transport. Applications utilizing the
library provide a
modbus_connection.ModbusUnitand may use any backend supported bymodbus-connection(pymodbus, tmodbus, ...).
Data provided by the library
flexit-modbus provides:
- the current and target supply-air temperature, and the outdoor air temperature,
- the fan mode (off/low/medium/high) and the actual air-speed reading,
- electric heater and cooling regulation levels (0-100%) and whether the electric heater is currently enabled,
- mechanical heat-recovery regulation level,
- filter running hours and the filter alarm state,
- a derived overall activity (heating, cooling, heat recovery, fan, or off), following the unit's own precedence,
- neutral datapoint metadata such as unit, min/max, step, and writable state,
- validated writes for the target temperature (10-30 °C) and fan mode.
Supported hardware
| Device | Adapter | Comments |
|---|---|---|
| Flexit air handling units (Nordic AC) | CI66 | Modbus RTU via the CI66 adapter |
Other Flexit units using the same CI66 Modbus register map are expected to work, since the adapter (not the ventilation unit itself) defines the Modbus interface used here.
Official documentation can be found here.
Usage
from modbus_connection import ModbusTcpParams
from modbus_connection.pymodbus import PymodbusConnection
from flexit_modbus import Flexit, FanMode
connection = PymodbusConnection(ModbusTcpParams(host="10.0.0.52", port=502))
await connection.connect()
device = Flexit(connection.for_unit(21))
await device.async_update()
print(device.target_temperature, device.measurements.supply_air_temperature)
print(device.activity)
await device.async_set_target_temperature(21.5)
await device.async_set_fan_mode(FanMode.HIGH)
Consumers that poll measurements and setpoints on different schedules can use
async_update_measurements() and async_update_setpoints() independently.
A command-line query tool is also provided; install the cli extra and run:
$ pip install flexit-modbus[cli]
$ python script/query.py 192.168.1.50 --unit 21
For a USB UART / RS-485 adapter (Modbus RTU), pass the serial device path and set serial transport explicitly:
$ python script/query.py /dev/ttyUSB0 --transport serial --unit 21
Run python script/query.py --help to see all transport, framing, timeout,
port, and serial options supplied by modbus-connection.
Testing and validation
The test suite runs entirely against the in-memory mock backend that ships
with modbus-connection — no real CI66 adapter or Modbus server is needed.
Run tests from the project root with either pytest directly or the helper
script:
$ pytest
$ ./script/libtest.sh
$ pytest tests/test_device.py
$ ./script/libtest.sh tests/test_device.py -k temperature
script/libtest.sh is a convenience wrapper around python -m pytest that:
- ensures
pytestandpytest-asyncioare installed for the selected Python, - adds
src/toPYTHONPATH, - adds a local checkout of
modbus-connectiontoPYTHONPATH.
By default it expects modbus-connection at
/config/dev/modbus-connection/src. If your checkout is elsewhere, set
MODBUS_CONNECTION_SRC before running:
$ MODBUS_CONNECTION_SRC=/path/to/modbus-connection/src ./script/libtest.sh
Any extra arguments are passed through to pytest.
Documentation, development and contribution guidelines
Use the helper scripts in script/ for a consistent local workflow:
./script/format.sh: formats the codebase../script/libcheck.sh: runs static checks/linting../script/libtest.sh: runs the library test suite (and wires the localmodbus-connectionsource path as described above).
A typical pre-PR run from the project root is:
$ ./script/format.sh
$ ./script/libcheck.sh
$ ./script/libtest.sh
You can pass additional pytest arguments through libtest.sh, for example:
$ ./script/libtest.sh -k activity -x
Pull requests are made against the develop branch.
Metadata
Release files for flexit-modbus 0.1.0
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 | |
|---|---|---|---|---|
| flexit_modbus-0.1.0.tar.gz | 18.7 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flexit_modbus-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.2 kB
Release files / flexit_modbus-0.1.0.tar.gz
| Download URL | flexit_modbus-0.1.0.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d86fb6584f671e1adb219c282e7a01939408b594761db39479cd6f0bf18deb0a
|
|
BLAKE2b-256 checksum How to use checksums |
24e3a2798d8ac7e431d65c80a0501483f5c60bbdfff85e67b9ca0ecae83bca51
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 25, 2026.
Transparency logRelease files / flexit_modbus-0.1.0-py3-none-any.whl
| Download URL | flexit_modbus-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc2be58d6baa37b533ee478a93a781692a9ebf8385780ea25d8b5ee4cac0645f
|
|
BLAKE2b-256 checksum How to use checksums |
067e8cc6bb0d48f30175ba8e011a845ca3bcc0bab3ed88016da71e95a9a3c9fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Aug 25, 2026.
Transparency logSecurity for flexit-modbus 0.1.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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for flexit_modbus-0.1.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 Aug 25, 2026.
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.