First steps with cumulocity

@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 P-L496G-CELL02 - LTE Cellular to Cloud Pack with STM32L496AG MCU - STMicroelectronics development board.
I performed a sanity check using the trial server from AVSystem and it worked very fine:
image

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

I also got the FORBIDDEN message in my LWM2M client and I solved it by making the name/id/endpoint id the same in the csv file I uploaded to register the tenant.

I was then able to start my LWM2M device with

java -jar device.jar -u lwm2m.eu-latest.cumulocity.com:5783 -n DevKit2

…and with a correct device protocol I could then receive measurements from it.

DevKit2 is the name I uses for name/id/endpoint id.

Hi @Robert_Neale !

thank you for your contact.

I tried some time, using your suggestions and playing with the URIs. I did these tests because I noticed that the URI that you used on the .csv file you sent to me is different than the URI used on the command line simulator.

I got the following results:

client and device: coap://lwm2m.eu-latest.cumulocity.com:5683

INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_reload.c:176]: servers reloaded
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connections.c:385]: server /0/0: transport change: (none) -> U (uri: coap://lwm2m.eu-latest.cumulocity.com:5683)
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connections.c:163]: reconnected
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:720]: Attempting to register with LwM2M version 1.0
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:689]: Register sent
WARNING [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:516]: server responded with 4.04 Not Found (expected 2.01 Created)
WARNING [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:551]: could not register to server 1

client and device: coap://lwm2m.cumulocity.com:5683

INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_reload.c:176]: servers reloaded
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connections.c:385]: server /0/0: transport change: (none) -> U (uri: coap://lwm2m.cumulocity.com:5683)
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connections.c:163]: reconnected
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:720]: Attempting to register with LwM2M version 1.0
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:689]: Register sent
WARNING [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:516]: server responded with 4.04 Not Found (expected 2.01 Created)
WARNING [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:551]: could not register to server 1
AUTOM TASK:  MODEM_DATA_READY_STATE - POLLING_TIMER_EVENT

client: coap://lwm2m.eu-latest.cumulocity.com:5783
device: coap://lwm2m.cumulocity.com:5683

INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_reload.c:176]: servers reloaded
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connections.c:385]: server /0/0: transport change: (none) -> U (uri: coap://lwm2m.eu-latest.cumulocity.com:5783)
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_connections.c:163]: reconnected
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:720]: Attempting to register with LwM2M version 1.0
INFO [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:689]: Register sent
AUTOM TASK:  MODEM_DATA_READY_STATE - POLLING_TIMER_EVENT
WARNING [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:516]: server responded with 4.03 Forbidden (expected 2.01 Created)
WARNING [anjay] [C:/sources/studies/lwm2m/Anjay-freertos-client/Middlewares/Third_Party/Anjay/src/core/servers/anjay_register.c:551]: could not register to server 1
AUTOM TASK:  MODEM_DATA_READY_STATE - POLLING_TIMER_EVENT

So, in all cases: no connection. But on the last case, the error message is different. Progress? I don’t know. I think that I’ll agree with @Stefan_Witschel and it should be a client problem.

Do you have some recommendations about clients that I can use? I was thinking about use my BG95 modem implementation, but after reading the documentation I guess that the BG95 lwm2m implementation doesn’t work with Cumulocity.

Can we do an online Teams session. What is your email?

Hi!
we can schedule a team session for tomorrow after the lunch. My email is rafael.diasmenezes@sloc.one

Hi!
as some of the suspect component at my implementation is the Anjay library and by technical motivations, I’m looking for other LwM2M client library to add to our code base.

I think that before I conclude this task with satisfactory success, I can’t do any integration test using Cumulocity.

one note: currently lwm2m-agent supports LWM2M version 1.0 and not 1.1. We are planning to support 1.1 in the future, it is in development phase

This anjay is 1.0.

anjay is too big for our solution.

I’m thinking about integrate the wakaama at our solution.