Device stays offline after registration and while storing measurement

Product/components used and version/fix level:

Detailed explanation of the problem:

We are registering and creating device from our custom java microservice. Devices are sending measurements to our custom java microservice and from there we are sending measurements to cumulocity.
In cumulocity we are able to view measurements with correct timestamp, but in ‘Device Management’ devices are seems ‘Offline’ and ‘Last communication’ is also not getting updated.

Error messages / full error message screenshot / log file:

Question related to a free trial, or to a production (customer) instance?

production (customer)

Hi @gagan.shah,

check this Device connection and status - #2 by Reuben_Miller2 and this
Device not showing online - #2 by Stefan_Witschel

1 Like

Hi Stefan,

Thank you for your response.

  1. I tried sending the empty PUT request from postman, it worked, “c8y_Availability” is “AVAILABLE” but “c8y_Connection” is “DISCONNECTED”.

With Java SDK it didn’t work.
In below code snippet, I am updating managed object without any addition property but its not updating.

ManagedObjectRepresentation measurementUploadMetadata = new ManagedObjectRepresentation();
measurementUploadMetadata.setId(GId.asGId(id));
inventoryApi.update(measurementUploadMetadata);

We are not using RestTemplate, it will be great, if you share cumulocity java sdk code sample.

  1. For 2nd point I am confused, how can we disable the header in SDK since all the methods are predefined.

Thanks,
Gagan

1 Like

Hi @gagan.shah ,

to 1. The second c8y_connection is only “green” when subscribed for operations via REST API (long-polling) or you have a MQTT client connected which is subscribed to “s/ds”. See also here: Device Management - Cumulocity IoT Guides

to 2: Use RestTemplate for the empty PUT request. Here are some nice example of Alex. You can see how to set the headers (authentication etc.), just adapt it to inventory API and you are fine.

1 Like

Hey @Stefan_Witschel , I have the same issue with Streaming analytics. Where i send a calculated data to a device using streaming analytics analytics builder, the measurement data received to the device successfully but the connection still shows offline, any idea?

Thanks,
Saif

Hi @saif.hasn

that is intended because streaming analytics should not influence the device connectivity status, only the agent should do this.
In other words: You can calculate values as you wish but if the device is not connected it should be stated as “offline”.

1 Like