KNXyz
Reference

Datapoint codecs

Encode and decode KNX datapoint values.

Datapoint codecs convert between application values and KNX payload bytes.

A DPT id identifies the KNX datapoint type. For example, 9.001 is the temperature variant of the DPT 9 two-byte float family.

The common API shape across packages is:

  • encode a DPT id and value into payload bytes
  • decode a DPT id and payload bytes into a value
  • return an error for unsupported DPT ids or invalid payloads

DPT 9.001 temperature is used throughout the quickstart because it has a compact two-byte payload and is easy to verify by round trip.

For 21.0, the encoded payload is 0c1a.

PackageValue shapePayload shape
RustDptValue::Temperature(21.0)Vec<u8>
Python21.0bytes
Node.js21.0Uint8Array

Implementation status

KNX defines many datapoint types. KNXyz currently implements selected DPTs in the high-level Rust, Python, and Node.js APIs. The raw C ABI and Cython native API are intentionally narrower and expose DPT 9.001 temperature only.

DPTMeaningRustPythonNode.jsC ABICythonNotes
1.001Switchyesyesyes--Boolean encode/decode.
5.001Scalingyesyesyes--Percent scaling encode/decode.
9.001TemperatureyesyesyesyesyesNative APIs expose this DPT only.
9.004Illuminancedecodedecodedecode--High-level decode support.
9.007Humiditydecodedecodedecode--High-level decode support.
17.001Scene numberyesyesyes--Scene number encode/decode.
18.001Scene controlyesyesyes--Scene control encode/decode.
other KNX DPTsStandard DPTspartialpartialpartial--More coverage planned.

Unsupported DPT ids, invalid payload lengths, and values outside the supported range return package-specific errors.

On this page