Standard Procedure OpenRemote to link "The Things Network" Integration

I have another Customer who likes to get Data from “The Things Network” and display the data in OpenRemote.
What I know is The Things Network can set up an Integration Interface. Is there a Standard Procedure coming from OpenRemote to do That?

Many Thanks for your Help

Roman

Hi,

We don’t have any existing code that integrates with the Things Network; I’m not familiar with the APIs they offer for 3rd party integration but it should be possible to connect OpenRemote to it in a simple way using the built in HTTP/MQTT/Websocket agents/protocols…assuming Things Network offers any of these APIs.

Hi @Roman, LoRaWan servers like ‘The Things Network’ are usually integrated via Webhooks (HTTP) or MQTT. We’ve already ordered LoRa test equipment in order to check what’s needed to integrate OpenRemote and ‘The Things Network’.

Hello,

Sorry for the rudimentary question.
With curl I can get the JSON file without any problems.

curl -G “https://eu1.cloud.thethings.network/api/v3/as/applications/myFunkyApplicationID/packages/storage/uplink_message
-H “Authorization: Bearer NNSXS.randomStuffHere”
-H “Accept: text/event-stream”
-d “limit=10”
-d “after=2020-08-20T00:00:00Z”

However, it cannot be obtained with HTTP Agent.
How do I place curl converted to JSON in OpenRemote?

{
“url”: “https://eu1.cloud.thethings.network/api/v3/as/applications/myFunkyApplicationID/packages/storage/uplink_message?limit=10&after=2020-08-20T00:00:00Z”,
“raw_url”: “https://eu1.cloud.thethings.network/api/v3/as/applications/myFunkyApplicationID/packages/storage/uplink_message?limit=10&after=2020-08-20T00:00:00Z”,
“method”: “get”,
“headers”: {
“Authorization”: “Bearer NNSXS.randomStuffHere”,
“Accept”: “text/event-stream”
}
}

Thank you.

1 Like

Hi,

I failed to integrate ‘The Things Network’ via the OpenRemote ‘HTTP Agent’. I think it’s currently not possible because streaming events from the server to the OpenRemote client is currently not supported (Accept: text/event-stream) .

I’ve managed to integrate ‘The Things Network’ by means of MQTT (see also tutorial: Receive LoRaWAN sensor data from ChirpStack) with the following procedure and settings:

  • In the TTN console select your application and select the ‘Integrations’ section on the left side in order to activate the MQTT integration
  • In OpenRemote create a MQTT agent with the following settings:
    host: eu1.cloud.thethings.network
    port: 8883
    secureMode: enabled
    usernamePassword:
    {
    “username”: “{TTN application id}@ttn”,
    “password”: “NNSXS…”
    }
  • Create an OpenRemote asset
  • Create an asset attribute with a suitable data type (e.g Number)
  • Add an ‘Agent link’ to the attribute and link it with the MQTT agent created earlier
  • Configure the ‘Agent link’ with the following parameters:
    ‘Subscription Topic’: v3/{TTN application id}@ttn/devices/eui-{DeviceEUI}/up
    ‘Value Filters’ of type ‘JSON Path’: $.uplink_message.decoded_payload.{name of sensor value}
2 Likes

Thank you rainerhitz,

I was able to get out of the pain of a week.

Please tell me a little more.
With Node-RED of the same Chrome browser, I can get data with MQTT.

I can’t get the data with OpenRemote yet, but can you see what’s wrong with this image?
I intend to set it in the same way.
“Subscription Topic” also failed with “#”.

I’ve noticed that currently a MQTT asset attribute (in your case the ‘Temperature’ attribute) doesn’t receive any updates anymore if the related MQTT agent is reconfigured or the whole server is restarted. I’ve looked at your configuration and it seems Ok except the JSON Path looks a bit strange. I think it’s a mixture of dot and bracket notation. I’ld suggest that you use the following JSON path:

$.uplink_message.decoded_payload.temperature_1

You could try the following procedure:

  • Check if the MQTT agent is in the ‘CONNECTED’ state
  • Delete the ‘temperature’ attribute
  • Add the ‘temperature’ attribute again with the JSON path that I’ve suggested

After this procedure you should see temperature updates.

2 Likes

Thanks rainerhitz,

I was able to get the data!
The JSON Path notation was incorrect.