First steps with cumulocity using lwm2m

Hi!
I’m trying to access the Cumulocity from my development kit P-L496-CELL02. I’m using the example firmware from AVSystem and I having some problems to setup the device parameters to use a unsecure connection.

I’m creating the device using the menu Device management>Devices>Registration>Bulk device registration . The device has been created on the platform but the development kit is not able to send data to the server.

To create the device, I’m using the following csv file:

“ID”;“CREDENTIALS”;“TYPE”;“NAME”;“IDTYPE”;“SHELL”;“com_cumulocity_model_Agent”;“lwm2m server uri”;“securityMode”
“DevKit-203335365736501400250007”;“DrWGXnB5t09y8g:+gu9^”;“c8y_lwm2m”;“DevKit”;“c8y_id”;“0”;“1”;“coap:// lwm2m . devicecertification-sloc . eu-latestcumulocity . com : 5783”;“NO_SEC”

I tried to use the non-secure 5783 and 5683, both failed.

To perform a sanity check, I tried to do the same using the coyote iot server from AVSystem. On this setup, I’m able to send data to the server.

Someone can help me with this integration?

Hi Rafael,

I’m don’t have any experience with this device but from what you’ve sent it seems the Server URL is wrong.
It should be coap://lwm2m.eu-latest.cumulocity.com with port 5783. Everything else look fine. Also you must make sure that the LWM2M Service is assigned to your tenant.

Regards
Stefan

Hi Stefan,
thank you by your answer.

For me is not appearing the LWM2M Service. Have I to create a new one?

Hi Rafael,

no, this service must be assigned to your Tenant by an Platform Administrator because it is an additional Feature. What instance are you using (what is the url of your tenant)?
You have to contact support or your contact to get it assigned.

Regards
Stefan

Hi Stefan,
good to know that.

I’m using a version that is not a commercial neither a trial version. As my boss tell me, it is a version enabled for device manufacturers.

The url that I have is: https:// devicecertification-sloc .eu-latest.cumulocity.com/

Hi Rafael,

ok, I try to get it assigned to your tenant. In the meantime did you try using the correct URL in the CSV and Agent: coap://lwm2m.eu-latest.cumulocity.com ?

Thank you.

I tried to use the url that you gave me, but the server is answering “server responded with 4.03 Forbidden (expected 2.01 Created)”. The data apparently is sent to the server, but nothing appear on the device management.

@Stefan_Witschel

I had to edit the last comment.

So, I was in contact with some guys from the commercial department and they enabled to me the LwM2M access. I received also a xml file with the common LwM2M descriptors to use at the LwM2M Protocol definitions. The unique element that is still problematic is the URI.

Try the following steps:

  1. Remove the device you’ve created so far with bulk registration in your tenant or switch to a new id and endpoint_id in the csv.
  2. Make sure all values in the csv are correct with url coap://lwm2m.eu-latest.cumulocity.com:5783 (which is the correct one)
  3. Perform the Bulk Registration.
  4. Edit your Client according the values and set the endpoint_ID and url to exact the one you’ve maintained in the csv.
  5. Connect the client.

Hi @Stefan_Witschel !

I had the same error:

I was trying to configure the LwM2M component and I noticed that is missing the Objects field:
my configuration:

the configuration from LWM2M - Cumulocity IoT Guides :

I think that it is missing something at the csv file…

Another question: How can I associate some measurement (i.e. temperature) with a LwM2M device?

best regards,
Rafael Dias

Hi Rafael,

the thing is I don’t know the client you are using and I think it is a configuration issues client-wise.
There is nothing missing in the CSV from Cumulocity perspective.

The questions is: Does your client require a bootstrap process or does it try directly to connect? The bootstrap port is 5683 (instead of 5783)

Are you sure that your client actually uses NO_SEC and not PSK? For PSK the CSV have to look differently and also to ports changes to 5684 and 5784: LWM2M - Cumulocity IoT Guides

The mapping to Measurements/Events/Alarms is done creating a device protocols LWM2M - Cumulocity IoT Guides but this is only working if you client is connected successfully.

Hi Stefan,
the client that I’m using is the Anjay library from AVSystem: GitHub - AVSystem/Anjay: C implementation of the client-side OMA LwM2M protocol

I got the example from AVSystem that implements the library into the https://www.st.com/en/evaluation-tools/p-l496g-cell02.html development board.
I performed a sanity check using the trial server from AVSystem and it worked very fine:

For the test connection, I’m using the NO_SEC connection, as you can verify on top of the image.

The URI that I’m using is the following: coap://try-anjay.avsystem.com:5683

about the Objects tab, is it correct not appear?

@Stefan_Witschel

look this topic: LWM2M Connection - #2 by Christian_Guether1
there @Christian_Guether1 argues that the lwm2m-agent should appear on my subscribed applications panel.

It is also not appearing to me. Is it correct?

The objects will only appear once you have successful connections.
Hm actually I thought it has been subscribed to your tenant recently. I’ll check that.

1 Like

We just checked and the lwm2m-agent should be subscribed to your assigned tenant.

1 Like

@rafael.diasmenezes The LWM2M appears under “Microservice”. In your tenant it is listed correctly:

Could you please provide the current CSV that you are using as the initial version was missing the “endpoint id”.

Best, Christian

Hi @Christian.Schade , thank you by the answer. Now I can see the Lwm2m-Agent.

well, the CSV that I used to create the device is the following:
Dev Kit registration.zip (348 Bytes)

Hi Rafael,

as Christian pointing out: The endpoint id is missing.
https://cumulocity.com/guides/protocol-integration/lwm2m/

It should have the same value as the ID and the endpoint id configured in the client.
https://avsystem.github.io/Anjay-doc/LwM2M.html

1 Like

thank you, @Stefan_Witschel

I added the field “endpoint id”, but it didn’t worked…
The Endpoint ID have the same value as ID: DevKit-203335365736501400250007