Skip to content

Commit 223dae7

Browse files
committed
Implement web-interface UI for device-profiles management.
1 parent 1c29331 commit 223dae7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+18810
-732
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ jobs:
3535
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
3636
-
3737
name: Run tests
38-
run: nix-shell --command "cd test-runner && cargo run"
38+
run: nix-shell --command "make nix-test"

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# hiddden files
2+
.*
3+
!.gitignore
4+
5+
# builds
6+
/interface/target
7+
/interface/ui/build
8+
/interface/ui/node_modules

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
.PHONY: test fmt devshell
1+
.PHONY: test nix-start nix-test
22

33
test:
4-
docker compose run --rm lorawan-device-profiles --run 'cd test-runner && cargo run'
4+
docker compose run --rm lorawan-device-profiles --run 'make nix-test'
55

6-
fmt:
7-
docker compose run --rm lorawan-device-profiles --run 'taplo fmt'
6+
nix-start:
7+
cd interface/ui && yarn build
8+
cd interface && cargo run
89

9-
devshell:
10-
docker-compose run --rm lorawan-device-profiles
10+
nix-test:
11+
cd interface && make api ui
12+
cd interface && cargo run run-tests

README.md

Lines changed: 46 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,52 @@ repository into their database.
1919
The goal of this repository is to provide an open-source database of LoRaWAN
2020
device-profiles that can be freely imported.
2121

22+
## Adding a new device-profile
23+
24+
### Fork and clone
25+
26+
* Create a fork of this repository (if not done already).
27+
* Clone your local fork to your computer.
28+
29+
### Starting the web-interface
30+
31+
* Please make sure that you have Docker Compose installed.
32+
* In the root of this repository, execute `docker compose up`.
33+
* Once `Starting server, bind: 0.0.0.0:8090` appears, open the web-interface in your browser by navigating to [http://localhost:8090](http://localhost:8090).
34+
35+
### Add Vendor(s)
36+
37+
* In the left menu, click the _Add vendor_ button.
38+
* Fill in the form and click _Submit_.
39+
40+
### Add profile(s)
41+
42+
* Select a vendor in the left menu (if no vendor is selected).
43+
* Click _Profiles_ in the left menu.
44+
* Click the _Create profile_ button.
45+
* Fill in the form and click _Submit_.
46+
47+
### Add codec(s)
48+
49+
* Select a vendor in the left menu (if no vendor is selected).
50+
* Click _Codecs_ in the left menu.
51+
* Click the _Create codec_ button.
52+
* Fill in the form, before clicking _Submit_ it is a good idea to click _Run codec tests_.
53+
54+
### Add device(s)
55+
56+
* Select a vendor in the left menu (if no vendor is selected).
57+
* Click _Devices_ in the left menu.
58+
* Click the _Create device_ button.
59+
* Fill in the form and add at least one firmware version by clicking the _Add firmware version_ button.
60+
* For each firmware version you can select one or multiple profiles and optionally a codec.
61+
62+
### Create pull-request
63+
64+
Once you have added the vendor(s), profile(s), codec(s) and device(s) you wish
65+
to add to this repository you must commit the changes using `git`, push these
66+
to your fork of this repository and create a pull-request in GitHub.
67+
2268
## Structure
2369

2470
Example structure for an `example-vendor` with an `example` device:
@@ -65,68 +111,6 @@ configuration.
65111
This directory contains the profiles. These profiles can be used by one
66112
or multiple devices. The profile also defines the region.
67113

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= ["temperature-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-
120-
## Running the test
121-
122-
To run the test-runner, execute:
123-
124-
```
125-
make test
126-
```
127-
128-
This will run all tests within a Docker Compose environment.
129-
130114
## License
131115

132116
This repository is distributed under the MIT license. See also `LICENSE`.

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@ services:
22
lorawan-device-profiles:
33
build:
44
context: .
5+
command: --run 'make nix-start'
6+
ports:
7+
- 8090:8090
58
volumes:
69
- ./:/lorawan-device-profiles

0 commit comments

Comments
 (0)