LogoLogo
  • KPN THINGS USER GUIDE
    • Introduction
    • Getting started
      • Registration and setup
      • Device simulator app
      • Connect devices
        • SIM cards
        • Supported devices and KPN Devices
        • SODAQ R412M
        • Smartrak
        • Marvin development board
        • LoPy5
        • Arduino MKR WAN 1300/1310
        • Arduin MKR NB 1500
    • All videos
    • Tutorials
      • Configure a flow
      • Connect a HTTPs destination
      • Create a simple IoT web applicationPage
      • Send instruction to LoRa DevicePage
      • Send your data to Azure SQL
      • Technical overview
        • Management data model
        • Uplink communication
        • Downlink communication
        • Location data
      • Accounts and projects
        • Customer accounts and users
        • Projects
        • Customer management
        • Cost overview and contract
    • Frequently asked
      • Multi Factor Authentication
  • GENERAL FUNCTIONS
    • Quick reference videos
    • APIs
  • THE PORTAL EXPLAINED
    • Things Manager
      • Devices
        • Bulk operations
      • Data
        • Device data graph
      • Connectivity
        • LoRa connectivity configuration
      • Bulk reports
    • Things Creator
    • Support
      • News
      • Release notes
      • Real-time status
      • Service reports
      • Documents
      • Support tickets
      • Invoices
      • Contact info
    • Shop
  • BUILDING BLOCKS
    • Devices
      • Sensors
        • KPN Conditionsensor CO2 II
        • KPN Conditionsensor CO2 III
        • KPN Conditionsensor CO2 III motionPage 1
        • KPN FillTag I
        • KPN FillTag II
        • 1M2M ED1608
        • Elsys ERS
        • Device Simulator (Mobile Phone app)
        • Generic Device (Internet connected)
        • Generic LoRa device (preset connectivity)
        • Generic LoRa device (programmable)
        • Generic M2M device
        • Generic M2M device (with Internet connection)
      • Trackers
        • KPN Global Tracker Autonomous
        • KPN Global Tracker Wired
        • KPN LocationTag I
        • KPN LocationTag II
        • KPN LocationTag II v2
        • KPN LocationTag II v2 Expert Mode
        • KPN LocationTag II v3
        • KPN LocationTag III (with GPS)
        • KPN LocationTag III (without GPS)
        • KPN LocationTag III v2
        • KPN LocationTag III v2 Buffer
        • KPN LocationTag III v3
        • KPN LocationTag III v4
        • KPN LocationTag V
        • KPN LocationTag VI
        • KPN LocationTag WS
        • Streamline LoRa
        • Streamline M2M
        • Viloc
      • Routers
      • Gateways
        • KPN FSK Basestation
      • Device SDK
    • Connectivity
      • Connecting LoRa devices
        • LoRa connectivity configuration
      • Connecting M2M devices
      • Connecting Internet devices
      • Connecting MQTT Devices
    • Data Processing
      • ThingsML and SenML
        • ThingsML
        • SenML
          • Understanding and Interpreting SenML Data
          • Changes in KPN SenML
      • Device Twin
      • Decoders and encoders
        • Common measurements list
        • Decoder migrations
        • DIY Decoder
          • DIY decoder scripts
      • Merger
      • Device data
      • Devices
    • Destinations
      • HTTPS destination
      • MQTT broker
      • Cumulocity IoT Platform
      • Azure Event Hubs
      • Azure IoT Hub
      • Test Endpoint
      • ThingsBoard
      • Datacake
      • AWS Lambda
      • Google Cloud Run functions
  • IOT LINE UP
    • Freemium
      • Test SIM cards
    • Explorer
    • Modular
    • Tailored
    • Terms and Conditions
Powered by GitBook

© 2024 KPN - All rights reserved.

On this page
  • Introduction
  • Attributes
  • Base values
  • Base name - bn - required in pack
  • Base time - bt - optional in pack
  • Name - n - required in record
  • Unit - u - optional in record
  • Time - t - optional in record
  • Number value - v - required in number record
  • Boolean value - vb - required in boolean record
  • String value - vs - required in string record
  • Data value - vd - required in data record
  • And more...
  • Client libraries
  • ThingsML, a SenML extension with extra compression

Was this helpful?

Export as PDF
  1. BUILDING BLOCKS
  2. Data Processing
  3. ThingsML and SenML

SenML

Introduction on the SenML data representation

PreviousThingsMLNextUnderstanding and Interpreting SenML Data

Last updated 3 months ago

Was this helpful?

For Freemium projects, the way KPN Things processes device data to SenML changed (per December 13th 2022). Read all the details about the .

SenML is the default data format for device data in KPN Things. Currently KPN Things only supports SenML in JSON. We plan to support SenML in CBOR in the future.

Introduction

A SenML message is officially called a SenML pack. One SenML pack consists of one or more SenML records. One SenML record expresses a single measurement. That way a SenML pack expresses a set of measurements

The first record in a SenML pack always contains base information. Base information expresses from which device the measurements are from (base name) and the moment the measurements were taken (base time).

There are different type of SenML records:

  • Number record - for communicating a number measurement

  • Boolean record - for communicating an on/off measurement

  • String record - for communicating a string measurement

  • Data record - for communicating raw data measurement

Below you find a non-exhaustive example of a SenML pack:

SenML example (explanation below)
[
  {"bn": "urn:dev:DEVEUI:0123456789ABCDEF:", "bt": 1.58565075E9, 
   "n": "temperature", "v": 20.5, "u": "Cel"},
  {"n": "batteryVoltage", "v": 3.6, "u": "V", "t": 10},
  {"n": "active", "vb": true},
  {"n": "modus", "vs": "Active"},
  {"n": "image", "vd": "aGFsbG9vb29vISE="}
]

Line nr.

Explanation

2

First line with base attributes, stating measurement source and timestamp.

3

Number record

4

Number record with relative time

5

Boolean record

6

String record

7

Data record

Attributes

This section explains the attributes you can use to express your measurements in SenML

Base values

Base name - bn - required in pack

  • urn stands for unique resource name.

  • dev means we are identifying a device.

  • DEVEUI is the type of device identifier used to identify the device.

  • 01234567890ABCDEF is the DevEUI, the device identifier.

In the example above we identify a LoRa device by its DEVEUI. If we would have an M2M device, we would identify it by its IMEI and the base name would be as following: urn:dev:IMEI:0123456789012345:.

A base name always ends with a colon :!

Base time - bt - optional in pack

Name - n - required in record

Name of the individual measurement.

Unit - u - optional in record

Unit of the measurement. Write your u-values in camel case, so start with a lower case character.

Time - t - optional in record

The timestamp of an individual record relative to the base time in seconds.

Example

You have a SenML pack with "bt": 1600185600 (2020-09-15T16:00:00+00:00) and the pack contains a measurement with "t": -60.

The timestamp of that measurement is then 2020-09-15T15:59:00+00:00, so one minute earlier then the base time.

Number value - v - required in number record

Value of the number measurement.

Boolean value - vb - required in boolean record

Boolean value for a boolean measurement. Should be true or false.

String value - vs - required in string record

String value for a string measurement.

Data value - vd - required in data record

And more...

There are more attributes in the SenML specification, but these values are not used by KPN Things. You can read about them in the Sensor Measurements Lists specification:

Client libraries

For easier integration with KPN Things we have created client libraries in C and Python for you to use in your devices.

ThingsML, a SenML extension with extra compression

When the and/or values are present in the pack, they are available in the first measurement of the pack and applicable for all the measurements in the pack.

The base name of a SenML pack states which device the measurements are from. It should contain a . The parts of the base name, which are colon separated, are as following:

The timestamp of the measurement in format. If KPN Things receives a measurement without base time, the time of receiving the measurement is taken as base time. SenML being sent by KPN Things will always contain a base time.

The (..) name MUST consist only of characters out of the set "A" to "Z", "a" to "z", and "0" to "9", as well as "-", ":", ".", "/", and "_"; furthermore, it MUST start with a character out of the set "A" to "Z", "a" to "z", or "0" to "9". - The SenML spec,

When designing your SenML measurement format for M2M and Internet devices, you should take into account our . By using as much name and unit pairs from that list, you achieve higher compatibility with current and future data processing features.

Data value for a data measurement. Should be a encoded string.

To make SenML more suitable for communication over LoRa, we have introduced . ThingsML is a valid extension of SenML that introduces measurement indices. We have , allowing you to only send the measurement index number instead of sending the complete name and unit of the measurement. .

Changes in KPN SenML
unique resource name
UNIX timestamp
RFC8428 section 4.5.1
Common measurements list
base64
ThingsML
listed several common measurements
Learn more about ThingsML
base name
base time
LogoRFC 8428 - Sensor Measurement Lists (SenML)
RFC 8428 - Sensor Measurement Lists (SenML)
Library Reference
Client libraries for SenML in JSON and CBOR format