# Generic LoRa device (programmable)

![Generic LoRa device (programmable)](https://portal.kpnthings.com/assets/images/device-types/own-lora.png)

Connect a LoRa device for which you currently do not have LoRa connectivity credentials (DevEUI, AppEUI, and AppKey). These credentials will be provided during registration of the device in KPN Things.

* Supported network type(s): `KPNLORA`
* Device Specification ID: `own-lora`
* Device Specification UUID: `1e7f596c-6eb4-44d2-bec6-0d93181d4330`

| Decoders                                 | decoderSpecificationUUID               | Description                                                                                                                                                                   |
| ---------------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| + LoRa Geolocation data                  | `aa2a1fa0-2613-4309-9ed6-72de96047d7d` | Add [LoRa Geolocation](https://docs.kpnthings.com/kpn-things/getting-started/tutorials/technical-overview/location-data) data to messages where location could be calculated. |
| = Raw LoRa payload                       | `6da609d1-0ec4-4f07-89e6-2acad60b7cdf` | Forward the raw LoRa payload and port number without decoding.                                                                                                                |
| = Raw LoRa payload (v2)                  | `1c0f77b0-2947-5e08-a5a8-d311cb094c3c` | Forward the raw LoRa payload and port number without decoding.                                                                                                                |
| = Raw LoRa payload Extended              | `f087f4f5-f603-47d3-be94-790e99b150cf` | Forward the raw LoRa payload and lora network metadata without decoding.                                                                                                      |
| = Raw LoRa payload Extended (v2)         | `71910f65-a9d6-587e-9148-c01ec440fdd2` | Forward the raw LoRa payload and lora network metadata without decoding.                                                                                                      |
| › Decoded ThingsML for LoRa payload      | `bdf13a5d-95f2-4595-baf0-cd807ff796b1` | Decoder for [ThingsML for LoRa](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/thingsml-and-senml/thingsml), a generic LoRa payload protocol by KPN.   |
| › Decoded ThingsML for LoRa payload (v2) | `174b8034-70c9-545a-9dfc-2e8353c5301d` | Decoder for [ThingsML for LoRa](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/thingsml-and-senml/thingsml), a generic LoRa payload protocol by KPN.   |

| Encoders           | encoderSpecificationUUID               | Description                           |
| ------------------ | -------------------------------------- | ------------------------------------- |
| = Raw LoRa payload | `30fdeedd-69e6-4ab5-8a90-2d58af7b3b2f` | Send raw LoRa payload to your device. |

### + LoRa Geolocation data

Add [LoRa Geolocation](https://docs.kpnthings.com/kpn-things/getting-started/tutorials/technical-overview/location-data) data to messages where location could be calculated.

### = Raw LoRa payload

Forward the raw LoRa payload and port number without decoding.

**Expected SenML records**

| name    | type   | unit |
| ------- | ------ | ---- |
| payload | string |      |
| port    | number |      |

### = Raw LoRa payload (v2)

Forward the raw LoRa payload and port number without decoding.

{% hint style="info" %}
This decoder also decodes [Geolocation and Local Gateway](https://docs.kpnthings.com/kpn-things/getting-started/tutorials/technical-overview/location-data) data.
{% endhint %}

The following SenML records can be present, amongst others:

| name    | type   | unit | example                    | description                            |
| ------- | ------ | ---- | -------------------------- | -------------------------------------- |
| payload | string |      | `"4D985C495AC4D8C9682CFD"` | The LoRa hex payload                   |
| port    | number |      | `200`                      | The LoRa port used to send this uplink |

#### Example SenML

{% hint style="info" %}
SenML can be structured in different ways, and we do not guarantee the examples below will look the same as what you will receive on your Destination. To make sure you can handle the SenML optimally, take a look at our documentation about [Understanding and Interpreting SenML Data](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/thingsml-and-senml/senml/understanding-and-interpreting-senml-data).
{% endhint %}

```json
[
    {
        "bn": "urn:dev:DEVEUI:0123456789012345:",
        "bt": 1693136532.83,
        "n": "payload",
        "vs": "4D985C495AC4D8C9682CFD"
    },
    {
        "n": "port",
        "v": 1
    },
    {
        "n": "timeOrigin",
        "vs": "NETWORK"
    }
]
```

### = Raw LoRa payload Extended

Forward the raw LoRa payload and lora network metadata without decoding.

**Expected SenML records**

| name      | type   | unit |
| --------- | ------ | ---- |
| ADRbit    | number |      |
| Channel   | string |      |
| DevLrrCnt | number |      |
| FCntDn    | number |      |
| FCntUp    | number |      |
| LrrESP    | string |      |
| LrrRSSI   | string |      |
| LrrSNR    | string |      |
| SpFact    | number |      |
| SubBand   | string |      |
| payload   | string |      |
| port      | number |      |

### Raw LoRa payload Extended (v2)

Forward the raw LoRa payload and lora network metadata without decoding.

Fixes from '= Raw LoRa payload Extended':

* `LrrRSSI` is changed to a `number`.
* `LrrSNR` is changed to a `number`.
* `LrrESP` is changed to a `number`.

{% hint style="info" %}
This decoder also decodes [Geolocation and Local Gateway](https://docs.kpnthings.com/kpn-things/getting-started/tutorials/technical-overview/location-data) data.
{% endhint %}

The following SenML records can be present, amongst others:

| name      | type   | unit | example                    | description                                  |
| --------- | ------ | ---- | -------------------------- | -------------------------------------------- |
| ADRbit    | number |      | `0`                        | Adaptive Data Rate indicator                 |
| Channel   | string |      | `LC255`                    | Lora channel of the transmission             |
| DevLrrCnt | number |      | `0`                        | Amount of gateways that received the message |
| FCntDn    | number |      | `21725`                    | The downlink framecounter                    |
| FCntUp    | number |      | `30117`                    | The uplink framecounter                      |
| LrrRSSI   | number |      | `0`                        | Received Signal Strength Indicator           |
| LrrSNR    | number |      | `0`                        | Signal to Noise Ratio                        |
| payload   | string |      | `"4D985C495AC4D8C9682CFD"` | raw hex payload string                       |
| port      | number |      | `1`                        | LoRa port used                               |
| SpFact    | number |      | `9`                        | Spreading factor used                        |
| SubBand   | string |      | `"G0"`                     | Lora band of the transmission                |

#### Example SenML

{% hint style="info" %}
SenML can be structured in different ways, and we do not guarantee the examples below will look the same as what you will receive on your Destination. To make sure you can handle the SenML optimally, take a look at our documentation about [Understanding and Interpreting SenML Data](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/thingsml-and-senml/senml/understanding-and-interpreting-senml-data).
{% endhint %}

```json
[
    {
        "bn": "urn:dev:DEVEUI:0123456789012345:",
        "bt": 1693136532.83,
        "n": "payload",
        "vs": "8ca683bd93124178afc5ff"
    },
    {
        "n": "port",
        "v": 1
    },
    {
        "n": "FCntUp",
        "v": 30117
    },
    {
        "n": "FCntDn",
        "v": 21725
    },
    {
        "n": "LrrRSSI",
        "v": 0
    },
    {
        "n": "LrrSNR",
        "v": 0
    },
    {
        "n": "DevLrrCnt",
        "v": 0
    },
    {
        "n": "SpFact",
        "v": 9
    },
    {
        "n": "SubBand",
        "vs": "G0"
    },
    {
        "n": "Channel",
        "vs": "LC255"
    },
    {
        "n": "ADRbit",
        "v": 0
    },
    {
        "n": "timeOrigin",
        "vs": "NETWORK"
    }
]
```

### › Decoded ThingsML for LoRa payload

Decoder for [ThingsML for LoRa](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/thingsml-and-senml/thingsml), a generic LoRa payload protocol by KPN.

### › Decoded ThingsML for LoRa payload (v2)

Decoder for [ThingsML for LoRa](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/thingsml-and-senml/thingsml), a generic LoRa payload protocol by KPN.

{% hint style="info" %}
This decoder also decodes [Geolocation and Local Gateway](https://docs.kpnthings.com/kpn-things/getting-started/tutorials/technical-overview/location-data) data.
{% endhint %}

#### Example SenML

{% hint style="info" %}
SenML can be structured in different ways, and we do not guarantee the examples below will look the same as what you will receive on your Destination. To make sure you can handle the SenML optimally, take a look at our documentation about [Understanding and Interpreting SenML Data](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/thingsml-and-senml/senml/understanding-and-interpreting-senml-data).
{% endhint %}

The resulting SenML completely depends on the ThingsML input and can produce almost any type of SenML output. The decoded ThingsML provided below is just an illustration of what is possible.

```json
[
    {
        "bn": "urn:dev:DEVEUI:6E5E267F2E6FB3BF:",
        "bt": 1693136532.83,
        "n": "latitude",
        "u": "lat",
        "v": 51.90717
    },
    {
        "n": "longitude",
        "u": "lon",
        "v": 4.48940
    },
    {
        "n": "temperature",
        "u": "Cel",
        "v": 29.75
    },
    {
        "n": "batteryVoltage",
        "u": "V",
        "v": 3.59
    },
    {
        "n": "extTemp",
        "u": "Cel",
        "v": 17.22
    },
    {
        "n": "io",
        "vb": false
    }
]
```

### = Raw LoRa payload encoding

* Protocol: LoRa downlink
* Description: Send raw LoRa payload to your device.
* Multiple commands in one downlink: No

Input mapping:

* Name: `payloadHex` (raw input)
