How do I connect my LoRa equipment to BAG-Tower?

Cedric Atzori

Last Update há 7 meses

For a more comprehensive article about LoRaWAN, please follow this link.

Requirements

- A LiveObjects account

- LoRa sensors already associated to this account

Create your device in BAG·Tower

- Connect and login to [BAG·Tower](https://bagtower.app/)

- Select the [*Asset List]* tab, then click the [*Add new asset*] on the top right of the page.

- Set the configuration parameters of your device in the opening form. Fill in its *Asset name*, *Group* and *Tags,* then set its emitting period.

- Then, expand the [Advanced settings] and use the *Default StreamId* defined in LiveObjects as *Asset ID* in BAG·Tower.

To get the *Default StreamId* in LiveObjects, as showcased in the pictures below:

- Connect to the platform,

- Click on the [Devices] top tab

- Click on the targetted device in the Device List,

Open the device's [Identity] left tab and copy the Default StreamId value.

Paste this value in the Asset ID field of the BAG·Tower form.

Transmit data from LiveObjects to BAG·Tower

Get back to LiveObjects and create a routing rule for the device :

- Open the [*Data*] top tab

- Select the [*Routing*] left tab

- Click on the [*+ Add a routing rule*] button.

On the "Choose one or more actions to be performed" step of the "Add a rule" process, scroll down and select the "Forward to one or more web servers in HTTP Push mode" by clicking on the [+ HTTP Push] button.

- In the opening form,

- Enter the following value in the *URL* field:

`https://api.bagtower.bag-era.fr/prod/logs`

- You may check the *Retry* checkbox.

- Then, you have to provide the BAG·Tower *API Key* in the HTTP Headers section.

The *HTTP header key* should be set to **x-api-key**, as the *HTTP header value* is the *API Key* *value* you get from BAG·Tower (grayed and set to XXXX... in the picture above).

- Select the *A Mustache formatted message* option in the *message body* section and enter the following value in the opening field, after replacing the *<companyId>* tag by your own companyId value, get from BAG·Tower (see previous point and the picture above):

As a result, the current form should be filled as this:

- Click the [*Next*] button at the bottom of the page.

- On the following "Routing conditions" step of the process, select the *Devices generated data > Data message* as the type of messages you wish to route. Do not add any filter in order to route all messages.

- Then click the [*Next*] button at the bottom of the page.

- Give a significant name to your rule, then click on the [*Complete*] button.

The rule should appear in the *Routing rules* list. By clicking on it to display its details, you should find a "*Forward to one or more web servers in HTTP Push mode*" block which reads as the following :

Just in case you find it fun, as described in the *LiveObjects REST API Guide* https://liveobjects.orange-business.com/swagger-ui/index.html, LiveObjects sends data to BAG·Tower according to the following format :

- <companyId> is your companyId

- <key> is your API Key : you can get it on any of your devices as, in LiveObjects, all sensors of a given company have the same APIKey.

- You may replace the <groupofthedevice> parametter with the group (or subgroup) name you have given to the device in the Routing options of LiveObjects.

Since then BAG·Tower receives data form LiveObjects.

However, the transmitted frames are not encoded as expected by BAG·Tower.

Create a decoder for your device

The code associated to your LoRa sensor should look like this. You may want to copy this code if you work with the same kind of devices as ours. Don't forget to test it on the BAG·Tower decoder form before validating it.

Then, the data sent from LiveObjects are received and decoded (then stored) in BAG·Tower.

You may wish to define alerts on the decoded values.

Was this article helpful?

0 out of 0 liked this article