View Source KNXex.DPT (knxex v0.1.0)
KNX data point types (DPT). This module only contains a subset of all DPTs.
KNX datapoints all have a type as well as a value. The type must be known in order to encode and decode a datapoint.
The datapoint type is a string, consisting of a main number and a subnumber
seperated by a dot, e.g. "1.001". The type carries information as to the
format, encoding, range and unit of the datapoint. A full list of datapoint
types can be seen in the KNX specification (document 3/7/2).
Most datapoint types are mapped directly to a single-valued Elixir data type, but complex KNX values are mapped to tuples. The below table lists these mappings:
| Datapoint Type | Elixir type | Encoded | Decoded |
|---|---|---|---|
| 1.* | boolean() | <<1::6>> | true |
| 2.* | {c, v}, all elements are integer() | <<3::6>> | {1, 1} |
| 3.* | {c, stepcode}, all elements are integer() | <<3>> | {0, 3} |
| 4.* | binary() | <<"T">> | "T" |
| 5.* | integer() | <<123>> | 123 |
| 6.* (except 6.020) | integer() | <<123>> | 123 |
| 6.020 | {a, b, c, d, e, f}, all elements are integer() | <<180>> | {1, 0, 1, 1, 0, 4} |
| 7.* | integer() | <<3421::16>> | 3421 |
| 8.* | integer() | <<3421::16>> | 3421 |
| 9.* | float() | <<13, 220>> | 30.0 |
| 10.* | {day, hour, minutes, seconds}, all elements are integer() | <204, 43, 12>> | {6, 12, 43, 12} |
| 11.* | {day, month, year}, all elements are integer() | <<12, 5, 19>> | {12, 5, 2019} |
| 12.* | integer() | <<203424034::32>> | 203424034 |
| 13.* | integer() | <<203424034::32>> | 203424034 |
| 14.* | float() | <<1174713696::32>> | 8493.34375 |
| 15.* | {d6, d5, d4, d3, d2, d1, e, p, d, c, index}, all elements are integer() | <<32, 118, 57, 158>> | {2, 0, 7, 6, 3, 9, 1, 0, 0, 1, 14} |
| 16.* | binary() | <<79, 75, 0, 0, ...>> | OK |
| 17.* | integer() | <<61>> | 61 |
| 18.* | {c, scene_number}, all elements are integer() | <<152>> | {1, 24} |
| 19.* | {{fault, dst, clock_quality}, NaiveDateTime.t() | :invalid_date_and_time}, first tuple element = all elements boolean() | <<122, 5, 7, ...>> | {{false, true, false}, ~N[2022-05-07 17:46:35]} |
| 20.* | integer() | <<13>> | 13 |
| 21.* | {b0, b1, b2, b3, b4, b5, b7}, all elements are boolean() | <<13>> | {true, false, true, true, false, false, false, false} |
| 22.* | {b0, b1, b2, b3, b4, b5, b7, ..., b15}, all elements are boolean() | <<13, 15>> | {true, true, true, true, false, ..., false} |
| 23.* | {a, b}, all elements are integer() | <<3::6>> | {1, 1} |
| 24.* | String.t() | <<75, 78, ..., 0>> | KNX is OK |
| 25.* | integer() | <<58>> | 58 |
| 26.* | {active, scene_number}, all elements are integer() | <<34>> | {0, 34} |
| 27.* | List of {onoff_state, valid} à 16 elements, all tuple elements are integer() | <<15, 240, 252, 15>> | [{1, 0}, ..., {0, 1}, .. {1, 1}, ...] |
| 28.* | String.t() | <<75, 78, ..., 0>> | KNX is OK |
| 29.* | integer() | <<255, 255, ...>> | -92363274911746 |
| 219.* | {lognumber, priority, app_area, error_class, attributes, alarmstatus_attributes}, all elements are integer() | <<128, 2, 1, 3, 0, 3>> | {128, 2, 1, 3, 0, 3} |
Link to this section Summary
Functions
Decodes the value according to the DPT.
Encodes the value according to the DPT.
Get all defined DPTs.
Link to this section Functions
Decodes the value according to the DPT.
Encodes the value according to the DPT.
Get all defined DPTs.
This will return a list of {type, name, value}, i.e. [{:dpt_1bit, "DPT_Switch", "1.001"}].