# KPN LocationTag II

![KPN LocationTag II](https://portal.kpnthings.com/assets/images/device-types/kpn-locationtag-ii.png)

Also known as Security Tag.

* Supported network type(s): `KPNLORA`
* Device Specification ID: `kpn-locationtag-ii`
* Device Specification UUID: `2f16485d-1301-4d11-9fb8-1b74b5a8909f`

| Decoders                                               | decoderSpecificationUUID               | Description                                                                                                                                                                       |
| ------------------------------------------------------ | -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| + LoRa Geolocation data                                | `d2593092-bc42-4b84-a053-2301f499bbc4` | Add [LoRa Geolocation](https://docs.kpnthings.com/kpn-things/getting-started/tutorials/technical-overview/location-data) data to messages where location could be calculated.     |
| + Location by LoRa On Premises Gateway reception       | `71703178-038d-4ea9-b865-00819fb42417` | Add location data to messages that are received by known [LoRa On Premise Gateways](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/decoders-and-encoders). |
| › Decoded payload for Device Management                | `aec28f98-7e78-4eb9-a314-04f435219bc5` | Decoder for Streamline LoRa short payloads, containing firmware version, mode, and battery status.                                                                                |
| › Decoded payload for Device Management (v2)           | `c0d1ea0f-2470-5f88-897c-c1ec25f360d6` | Decoder for Streamline LoRa short payloads, containing firmware version, mode, and battery status.                                                                                |
| › Decoded payload for Medical Tracker application      | `9e8b2100-537d-46f8-ab21-4fad11d04bc9` | Decoder for Streamline LoRa message type 0xD282 containing only temperature and movement bit.                                                                                     |
| › Decoded payload for Medical Tracker application (v2) | `6a7a4ef4-e7a3-5eab-90ba-6901cf360d08` | Decoder for Streamline LoRa message type 0xD282 containing only temperature and movement bit.                                                                                     |

| Encoders                                              | encoderSpecificationUUID               | Description                                                                                                                      |
| ----------------------------------------------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| ‹ Encoded device modes for Asset Recovery application | `9e2a47a3-a239-4f1f-b14b-f16fa70fe99d` | Send device modes for Asset Recovery: Presales (24h interval), Active (2h interval), Missing (5min interval + BLE), or Inactive. |

### + 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.

#### Expected SenML outputs

<table><thead><tr><th width="179.33333333333331">name</th><th width="128">type/unit</th><th width="135">example</th><th>description</th></tr></thead><tbody><tr><td>locOrigin</td><td>string</td><td>KPNLORA</td><td>indicates the origin of the location data</td></tr><tr><td>latitude</td><td>numeric</td><td>51.79</td><td></td></tr><tr><td>longitude</td><td>numeric</td><td>4.68</td><td></td></tr><tr><td>radius</td><td>m</td><td>319</td><td></td></tr><tr><td>locAccuracy</td><td>%</td><td></td><td></td></tr><tr><td>locPrecision</td><td>%</td><td></td><td></td></tr><tr><td>locTime</td><td>timestamp</td><td>1637165561</td><td></td></tr></tbody></table>

#### Example SenML-message

This location info can be merged with the payload of the device

```
[
  {
    "bn": "urn:dev:DEVEUI:A41163C212345678:",
    "bt": 1637165561
  },
  {
    "n": "locOrigin",
    "vs": "KPNLORA"
  },
  {
    "n": "latitude",
    "u": "lat",
    "v": 51.794884
  },
  {
    "n": "longitude",
    "u": "lon",
    "v": 4.687986
  },
  {
    "n": "radius",
    "u": "m",
    "v": 319.730194
  },
  {
    "n": "locAccuracy",
    "u": "%",
    "v": 9999
  },
  {
    "n": "locPrecision",
    "u": "%",
    "v": 9999
  },
  {
    "n": "locTime",
    "vs": "1637165561192"
  }
]
```

### + Location by LoRa On Premises Gateway reception

Add location data to messages that are received by known [LoRa On Premise Gateways](https://docs.kpnthings.com/kpn-things/building-blocks/data-processing/decoders-and-encoders).

#### Expected SenML outputs

See above. Output is comparable to LoRa Geolocation data.

### › Decoded payload for Device Management

Decoder for Streamline LoRa short payloads, containing firmware version, mode, and battery status.

#### Expected SenML output attributes

<table><thead><tr><th width="181.33333333333331">name</th><th width="128">type/unit</th><th width="120">example</th><th>description</th></tr></thead><tbody><tr><td>mode</td><td>string</td><td>active</td><td>operation modus (production, active, presales, missing)</td></tr><tr><td>batteryVoltage</td><td>V</td><td>3.58</td><td></td></tr><tr><td>batteryLevelLow</td><td>boolean</td><td>false</td><td>indicates if the battery voltage has been below the threshold</td></tr><tr><td>timeOrigin</td><td>string</td><td>NETWORK</td><td>indicates the origin of the timestamp</td></tr><tr><td>firmwareVersion</td><td>string</td><td></td><td>firmware info, only sent after device boot</td></tr><tr><td>firmwareCRC</td><td>string</td><td></td><td>firmware info, only sent after device boot</td></tr><tr><td>settingsCRC</td><td>string</td><td></td><td>settings info, only sent after device boot</td></tr></tbody></table>

#### Example SenML messages

```
[
	{
		"n": "mode",
		"u": "enum",
		"bn": "urn:dev:DEVEUI:7CC6C40512345678:",
		"bt": 1678778462,
		"vs": "active"
	},
	{
		"n": "batteryVoltage",
		"u": "V",
		"v": 3.58
	},
	{
		"n": "batteryLevelLow",
		"vb": false
	},
	{
		"n": "timeOrigin",
		"u": "enum",
		"vs": "NETWORK"
	}
]
```

The first 10 messages after boot of a device contain firmware information attributes:

```
[
	{
		"n": "mode",
		"u": "enum",
		"bn": "urn:dev:DEVEUI:7CC6C40512345678:",
		"bt": 1678864786,
		"vs": "active"
	},
	{
		"n": "batteryVoltage",
		"u": "V",
		"v": 3.37
	},
	{
		"n": "batteryLevelLow",
		"vb": false
	},
	{
		"n": "firmwareVersion",
		"vs": "0443"
	},
	{
		"n": "firmwareCRC",
		"vs": "397f"
	},
	{
		"n": "settingsCRC",
		"vs": "a3e5"
	},
	{
		"n": "timeOrigin",
		"u": "enum",
		"vs": "NETWORK"
	}
]
```

### › Decoded payload for Device Management (v2)

Decoder for Streamline LoRa short payloads, containing firmware version, mode, and battery status.

{% 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:

<table><thead><tr><th width="174">name</th><th width="98">type</th><th width="59">unit</th><th width="125">example</th><th>description</th></tr></thead><tbody><tr><td>batteryLevelLow</td><td>boolean</td><td></td><td><code>false</code></td><td>Indicates if the battery voltage has been below the threshold</td></tr><tr><td>batteryVoltage</td><td>number</td><td>V</td><td></td><td></td></tr><tr><td>firmwareCRC</td><td>string</td><td></td><td></td><td>Firmware info, only sent after device boot</td></tr><tr><td>firmwareVersion</td><td>string</td><td></td><td></td><td>Firmware info, only sent after device boot</td></tr><tr><td>mode</td><td>string</td><td></td><td><code>"active"</code></td><td>Operation modus. Either <code>"production"</code>, <code>"active"</code>, <code>"presales"</code> or <code>"missing"</code>)</td></tr><tr><td>settingsCRC</td><td>string</td><td></td><td></td><td>Settings info, only sent after device boot</td></tr></tbody></table>

#### 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": "mode",
        "vs": "active"
    },
    {
        "n": "batteryLevelLow",
        "vb": false
    },
    {
        "n": "batteryVoltage",
        "u": "V",
        "v": 3.59
    },
    {
        "n": "firmwareVersion",
        "vs": "0443"
    },
    {
        "n": "firmwareCRC",
        "vs": "397F"
    },
    {
        "n": "settingsCRC",
        "vs": "A3E5"
    },
    {
        "n": "timeOrigin",
        "vs": "NETWORK"
    }
]
```

### › Decoded payload for Medical Tracker application

Decoder for Streamline LoRa message type 0xD282 containing only temperature and movement bit.

**Expected SenML records**

| name                              | type    | unit |
| --------------------------------- | ------- | ---- |
| hasMovedSincePreviousTransmission | boolean | /    |
| temperature                       | number  | Cel  |

### › Decoded payload for Medical Tracker application (v2)

Decoder for Streamline LoRa message type 0xD282 containing only temperature and movement bit.

{% 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 |
| --------------------------------- | ------- | ---- | -------- | ----------- |
| hasMovedSincePreviousTransmission | boolean |      | `true`   |             |
| temperature                       | number  | Cel  | `18.875` |             |

#### 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": 1633896968.04,
        "n": "temperature",
        "u": "Cel",
        "v": 18.875
    },
    {
        "n": "hasMovedSincePreviousTransmission",
        "vb": true
    },
    {
        "n": "timeOrigin",
        "vs": "NETWORK"
    }
]
```

### ‹ Encoded device modes for Asset Recovery application

* Protocol: LoRa downlink
* Description: Send device modes for Asset Recovery: Presales (24h interval), Active (2h interval), Missing (5min interval + BLE), or Inactive.
* Multiple commands in one downlink: No

Input mapping:

* Name: `mode`
  * Value: `Presales` (translates into → `150098078051010080510115013F01001501FB018016`)
  * Value: `Active` (translates into → `15009807201C0000201C0015013F01001501FB014016`)
  * Value: `Missing` (translates into → `15009807F0000000F0000015013907000000000000001501FB01C1150402010115040E010015042C02050516`)
  * Value: `Inactive` (translates into → `14009808FFFFFFFFFFFFFFFF110000000001000000`)
