Cumulocity and SENML

Hi,

Is it possible to send a timestamped multiple log SENML payload to Cumulocity using LWM2M?

I know that is doable via HTTP but I am interesting in using my IoT device to do so that uses LWM2M. I am using the Wakaama library and I believe it’s not possible with that either to send json blobs, only objects with its resources.

So my question is, has anyone had any experience with SENML json and cumolocity and what stacks have you used to succeed in doing so?

I have tried sending my SENML json blob as a resource but that would require server side decoding I would imagine.

thanks

Hi Hariss,

first of all, please apologize for the long delay with this answer.

The good news is that a device may send historic values with timestamps to the Cumulocity LWM2M server. The key here is to use the LWM2M Send directive, which was introduced in LWM2M 1.1.

You can try this out easily using the demo client of Eclipse Leshan (link below). After building the leshan client, it works like this:

  1. Register a LWM2M Device on your tenant, say urn:harris:leshan:mytestdevice

  2. Connect Leshan:

    java -jar target/leshan-demo-client-2.0.0-SNAPSHOT-jar-with-dependencies.jar -n urn:harris:leshan:mytestdevice -u ``lwm2m.eu-latest.cumulocity.com:5783

  3. When the device is registered, use the collect command, for example collect /3303/0/5700 to collect a current timestamp

  4. After collecting a number of values, you can send them together with their timestamps to Cumulocity using the following command:
    send --content-format=SENML_JSON collected-value

The demo client then sends its data using SENML_JSON using the following syntax:

[
  {
    "bn": "/3303/0/5700",
    "bt": 1767012462.785322,
    "v": 19.2
  },
  {
    "bn": "/3303/0/5700",
    "bt": 1767012466.293416,
    "v": 19.9
  },
  {
    "bn": "/3303/0/5700",
    "bt": 1767012467.836985,
    "v": 19.9
  },
  {
    "bn": "/3303/0/5700",
    "bt": 1767012469.343837,
    "v": 20.0
  },
  {
    "bn": "/3303/0/5700",
    "bt": 1767012470.486596,
    "v": 20.4
  },
  {
    "bn": "/3303/0/5700",
    "bt": 1767012471.715175,
    "v": 20.4
  }
]

Hope this helps!

Elias, Engineering Manager

1 Like

Ok thank you very much. I managed to do it thanks to your help.