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.
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.
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?
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”.
Is there any way to manipulate it from the streaming analytics or any managejObjects block so we can make this offline status work? Or do you have any workaround?
Our case is that we create a device in c8y just to received aggregated or average data from one or more device via streaming analytics and we would like the device to have availability status working.
Do you know if any data committing from streaming analytics counts for MEA charges or not?
to 1: You cannot do this with Analytics Builder. If you send calculated data to a device using streaming analytics the device is considered to be offline which is correct because no other component is involved managing the connection status of the device. Actually in your case the connection status should be totally ignored. More precisely I assume when you do that you want to send data to an asset (which does not have any connectivity status) not to a device.
You can add an external component sending empty PUTs to the managed object / device within the defined required interval.
Please note that this has to be an external component not using the header X-Cumulocity-Application-Key in that PUT request otherwise it will be ignored again.
to 2: Again, it seems to me that it is not a device you are creating but assets where you are storing aggregated data on. It does not make sense to have the connection availability status working if you don’t have any real physical connection to that device which could be managed. Everything else would be just confusing simulating any connectivity status which is not existing.
I can’t answer your pricing conditions in regards of MEA charges because they really depend on your contract and you should clarify them with your Software AG Sales / Partner contact.
Thank you @Stefan_Witschel for all the information, really helpful. You suggest to add an external component sending empty PUTs to the managedObjects, do you know a way how to send this via streaming analytics? And can you also give me the empty PUT exampple?
It’s not possible using streaming analytics, as streaming analytics uses this header so it is not recognized as a “device request” updating the connectivity status.
It’s true that Streaming Analytics by default will use the configured application key for all requests. However, you can create a custom connection to override that:
Create a Cumulocity_RequestInterface object as described in EPL Apps - Cumulocity IoT documentation
CumulocityRequestInterface cumulocity := CumulocityRequestInterface.connectToCumulocity();
Override the appKey
cumulocity.appKey := “”;
Create a request to the endpoint manually:
Request r := cumulocity.createRequest(“PUT”, “/inventory/managedObjects/”+id, new any);
r.execute(callbackAction);
This will avoid having to add an additional extra component.
thx, I never stop learning! I was not aware, that you can override the appKey header within EPL App.
@saif.hasn Still, you should ask yourself if this make sense in your use case. The intention of the connectivity status is to monitor the physical connection of a device to Cumulocity. If the device does not have any physical connection I would rather argue that this is an asset holding calculated data (without any connectivity status). The device that get’s the “raw” device data has a physical connection and therefor a connectivity status.
Yes, it makes sense, and we are not going to apply this to all of our devices. These are just a few devices where we would like to verify if they are receiving data from the streaming analytics or not.
@Matthew_Johnson do we know if we can override the header from “Analytics builder” as well?