Data Types
When you receive raw bytes from a group address, you have to know the data type to correctly decode it. In most cases the group address has already an associated data type defined in the ETS project.
Depending on the data type, the raw bytes are interpreted differently. For example a single bit is represented by the data type DPT-1 (also known as B1 or just 1). But because the value 1 and 0 can have different meanings, there are several subtypes available.
ID | Name | Encoding |
---|---|---|
DPST-1-1 | Switch | 0 = Off 1 = On |
DPST-1-2 | Bool | 0 = False 1 = True |
DPST-1-5 | Alarm | 0 = No alarm 1 = Alarm |
When you create an accessory in hkknx, you have to select the correct data type for the characteristics of that accessory. For example a contact sensor has the characteristic “Contact Detected”, which supports the subtypes DPST-1-2 and DPST-1-5. Depending on the selected subtype, the sensors decode the received bytes from KNX bus differently.
Both subtypes are derived the type DPT-1, meaning that they both represent a single bit. But the values 1 and 0 have different meanings.
DPST-1-2 defines the value 1 as True. In the case of the characteristic Contact Detected, it means that contact is detected.
DPST-1-5 defines the value 1 as Alarm. This means that no contact is detected.