@@ -65,6 +65,58 @@ configuration.
65
65
This directory contains the profiles. These profiles can be used by one
66
66
or multiple devices. The profile also defines the region.
67
67
68
+ ## Adding a new device-profile
69
+
70
+ In summary, these are the steps to create a new device-profile.
71
+
72
+ 1 . ** Add a new vendor directory in ` vendors/ ` .** This directory should be
73
+ lower-cased, and spaces must be replaced by ` - ` . For example for
74
+ _ My Vendor_ you would create a directory ` vendors/my-vendor/ ` .
75
+
76
+ 2 . ** Create ` vendor.toml ` file.** Inside the directory created in the previous
77
+ step, create a ` vendor.toml ` file (e.g. ` vendors/my-vendor/vendor.toml ` ).
78
+ Please use ` vendors/example-vendor/vendor.toml ` as an example. Under ` devices `
79
+ you want to refer to the devices (that you will add in the next steps).
80
+ If you have a temperature and a humidity sensor device (thus two devices),
81
+ your ` devices ` configuration could look like:
82
+ ` devices = ["temperature.toml", "humidity.toml"] `
83
+
84
+ 3 . ** Create device file(s).** In this step you need to create a file for each
85
+ device that you configured in the previous step under ` devices ` . To
86
+ continue with the previous example, you would create two files:
87
+ * ` vendors/my-vendor/devices/temperature.toml `
88
+ * ` vendors/my-vendor/devices/humidity.toml `
89
+ You can use ` vendors/example-vendor/devices/example.toml ` as an example.
90
+ For each firmware version (if there are multiple), make sure to also
91
+ configure the ` profiles ` and ` codec ` options (if you provide a payload)
92
+ codec. For example your ` temperature.toml ` device configuration could
93
+ contain ` profiles= ["temerature-eu868.toml", "temperature-us915.toml"] ` and
94
+ ` codec = "temperature.js" ` if there a a codec for this device.
95
+
96
+ 4 . ** Create profile file(s).** In this step you need to create a file for
97
+ each profile that you configured in the previous step for your device(s).
98
+ To continue with the previous example, you would create:
99
+ * ` vendors/my-vendor/profiles/temperature-eu868.toml `
100
+ * ` vendors/my-vendor/profiles/temperature-us915.toml `
101
+ You can use ` vendors/example-vendor/profiles/example-EU868.toml ` as an
102
+ example.
103
+
104
+ 5 . ** Create codec file(s).** If you have configured any ` codec ` options, you
105
+ must create these codec files. To continue with the previous example, you
106
+ would create a file named ` vendors/my-vendor/codecs/temperature.js ` . You
107
+ can use ` vendors/example-vendor/codecs/example.js ` as an example.
108
+
109
+ 6 . ** Add codec tests (optional).** To validate that the codec returns the
110
+ expected output given a certain input you can add tests to your codecs.
111
+ To continue with the previous example, you would create two files:
112
+ * ` vendors/my-vendor/codecs/test_decode_temperature.json `
113
+ * ` vendors/my-vendor/codecs/test_encode_temperature.json `
114
+ Please see ` test_decode_example.json ` and ` test_encode_example.json ` in
115
+ the ` vendors/example-vendor/codecs ` directory.
116
+
117
+ 7 . ** Run tests.** This validates that the above configuration can be parsed
118
+ correctly and that the codec return the expected output.
119
+
68
120
## Running the test
69
121
70
122
To run the test-runner, execute:
0 commit comments