You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changes to these entities must always happen in OS2iot, which is then
163
161
synchronized to Chirpstack. It is not supported to change data directly
164
-
in Chirpstack. All manipulation of settings in the Chirpstack is thus
165
-
done via the Chirpstack API. If locally running on port 8080 then Chirpstack Application Services Swagger UI is available at http://localhost:8080/api
166
-
167
-
There is no direct mapping between applications in OS2iot and applications in Chirpstack, even though they cover a similar concept.
168
-
Instead, a separate Chirpstack application is created for each separate ServiceProfile created through OS2iot.
169
-
170
-
The new Chirpstack application is created the first time a device with a previously unused ServiceProfile is added to an OS2iot application.
171
-
This is illustrated in the flowchart below:
172
-
|image13|
162
+
in Chirpstack. The protocol documentation for the api is documented at https://www.chirpstack.io/docs/chirpstack/api/api.html.
173
163
174
164
Security
175
165
~~~~~~~~
@@ -178,76 +168,33 @@ OS2iot and Chirpstack have separate security models and do not share
178
168
users. Instead, all communication between OS2iot and Chirpstack is done
179
169
using a service account with administrator permissions in Chirpstack.
180
170
181
-
For communicating with the chirpstack api, it is necessary to set up a
182
-
JWT token.
171
+
For communicating with the chirpstack api, it is necessary to create a apikey on Chirpstack, which you must insert in the environment variable: :code:`CHIRPSTACK_API_KEY`.
183
172
184
-
We use the following code to generate a valid JWT for Chirpstack, here the is taken from the environment variable: :code:`CHIRPSTACK_JWTSECRET`, as described in `the installation guide <../installation-guide/installation-guide.html#id1>`_.
173
+
This apikey is included in the header in every call to the Chirpstack api and has the format of an Bearer token:
185
174
186
175
.. code-block:: typescript
187
176
188
-
@Injectable()
189
-
exportclassJwtToken {
190
-
static setupToken():string {
191
-
const claims = {
192
-
iss: "as", // issuer of the claim
193
-
aud: "as", // audience for which the claim is intended
194
-
iat: Math.floor(newDate().valueOf() /1000-10), // unix time from which the token is valid
195
-
nbf: Math.floor(newDate().valueOf() /1000-10), // unix time from which the token is valid
196
-
exp: Math.floor(newDate().valueOf() /1000) +60*60*24*14, // unix time when the token expires
197
-
sub: "user", // subject of the claim (an user)
198
-
username: "admin", // username the client claims to be
The JWT is used as part of a special header named: :code:`Grpc-Metadata-Authorization`, while the value is the standard authorization header for a JWT as a Bearer token.
In order to use the Chirpstack for LoRaWAN devices certain things has to be set up, in a
227
-
specific order.
228
-
229
-
- Network server
230
-
231
-
- The network server has to be added. This is set up as a
232
-
automatic process on startup of OS2iot backend.
186
+
In order to use the Chirpstack for LoRaWAN devices certain things has to be set up.
233
187
234
188
- Gateway
235
189
236
-
- Create gateway profile
237
-
238
-
- Add a minimum of 1 gateway server to the system (this is done automatically).
190
+
- Register gateway
239
191
240
192
- Devices
241
193
242
-
- Create service profile
243
-
244
194
- Create device profile
245
195
246
196
- Register device
247
197
248
-
- Note that once a Service Profile has been selected, it can't be
249
-
changed.
250
-
251
198
Error handling
252
199
~~~~~~~~~~~~~~
253
200
@@ -258,8 +205,7 @@ If the error occured without it being caused by a user, e.g. IoT-device sends da
258
205
Communicating with edge devices
259
206
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
260
207
261
-
REST API is the easiest way to send payloads to edge devices. Retrieving
262
-
data is done via MQTT.
208
+
REST API is the easiest way to send payloads to edge devices. Retrieving data is done via MQTT.
263
209
264
210
Reading data
265
211
@@ -281,17 +227,6 @@ Reading data
281
227
scheduling or handling. E.g. in case when a payload could not be
282
228
scheduled as it exceeds the maximum payload-size.
283
229
284
-
Register network server
285
-
~~~~~~~~~~~~~~~~~~~~~~~
286
-
287
-
When registering the network server. The server attribute has to be set
288
-
according to the docker container followed by port 8000 as shown in the
289
-
following example.
290
-
291
-
**"server":"chirpstack-network-server:8000",**
292
-
293
-
.. _register-new-device-1:
294
-
295
230
Register new device
296
231
~~~~~~~~~~~~~~~~~~~
297
232
@@ -301,12 +236,10 @@ means. Over-the-Air Activation (OTAA) and Activation by Personalization
301
236
with Network. The network assigns a dynamic DevAddr and negotiate
302
237
security keys with the device. In other cases the DevAddr as well as the
303
238
security keys is hardcoded in the device. This means activating a device
304
-
by personalization (ABP). "Device profile" and "Service profil" has to
305
-
be set In order to register a device. The *Device Profile* defines the
306
-
boot **parameters** that are needed by ChirpStack Network Server to
307
-
“connect” with a edge device. The *Service Profile* defines the features
308
-
that are enabled for the devices and the rate of messages that can send
309
-
over the network by a device.
239
+
by personalization (ABP). "Device profile" has to
240
+
be set in order to register a device. The *Device Profile* defines the
241
+
boot **parameters** that are needed by the ChirpStack Server to
242
+
“connect” with a edge device.
310
243
311
244
.. _update-existing-device-1:
312
245
@@ -316,7 +249,7 @@ MQTT
316
249
There are two kinds of MQTT devices available. MQTT external broker and MQTT internal broker. These two devices works in different matters which will be described below.
317
250
318
251
MQTT external broker
319
-
~~~~~~~~~~~~~~
252
+
~~~~~~~~~~~~~~~~~~~~~~
320
253
The MQTT external broker device will make it possible for a physical device to communicate with the internal OS2IoT mosquitto broker.
321
254
The MQTT external broker is created in the OS2IoT backend and is created with the credentials that the device needs for communicating with the internal broker.
322
255
@@ -331,7 +264,7 @@ The specific topic for the created device will be :code:`device/organizationID/a
331
264
332
265
333
266
MQTT internal broker
334
-
~~~~~~~~~~~~~~~
267
+
~~~~~~~~~~~~~~~~~~~~~
335
268
336
269
The MQTT internal broker uses the MQTT protocol to subscribe to a topic on an external MQTT broker. A client is created in the OS2IoT backend.
337
270
This client will connect to the external MQTT broker using the provided URL, port and authentication, and then subscribe to data on the provided topic.
@@ -548,11 +481,9 @@ KOMBIT Adgangstyring
548
481
See `the seperate page for KOMBIT adgangsstyring <../kombit-adgangsstyring/kombit-adgangsstyring.html>`_
0 commit comments