The first things, we are using the cumulocity sdk API to insert a measurement to the device as given the code below
MeasurementRepresentation createMr = new MeasurementRepresentation();
createMr.set("measurement",xyz);
createMr.setSource(xxx);
createMr.setType(xxx);
createMr.setDateTime(dateTime);
measurementApi.create(createMr);
We are inserting every minute. But the device status in the manged object of the device is shown as unavilable
"c8y_Availability": {
"status": "UNAVAILABLE"
}
But for the same device if we insert the measurement through restapi at the same interval we get the device status as available
The insertion is done as given below
https://dev1.iot-dev.solenis.com/measurement/measurements
{
"fragment1": {
"Measurement1": {
"unit": "upm",
"value": 39
}
},
"time": ",
"source": {
"id": <<deviceId>>
},
"type": "fragment1"
}
Can somebody please let me know what could be the issue with creating measurements for a device using cumulocity sdk api
Basically you need to remove the X-Cumulocity-Application-Key header from the request or sending additional empty PUT requests (without the header) to update the status manually.