Unable to publish messages through thin-io.edge to child devices that are created with the cumulocity IoT Open API

What product/components do you use and which version/fix level are you on?

Thin-edge and cumulocity IoT

Is your question related to the free trial, or to a production (customer) instance?

free trail

What are you trying to achieve? Please describe it in detail.

We have created the child devices using cumulocity IoT APIs. The thin-edge is installed on the parent device(gateway) . We are unable to publish the events through the thin-edge to child devices.

Do you get any error messages? Please provide a full error message screenshot and log file.

The published events are not present in the events column of child devices.

Have you installed all the latest fixes for the products and systems you are using?

yes

Hi,

one common mistake might be the owner of the device. If you created the child device via the API the device owner is set according the user that was used for the API call. Thus thin-edge.io can not send data to that particular child device. There are two solutions for that:

  1. Create the child via thin-edge.io
  2. Change the device owner within the ui to the same user as the parent device

image

Hi Murat,
Thank you for the solutions.

  1. We are able to publish the events to the child devices that are created with the thinedge.
  2. The other way of publishing the events to the child devices that are created using cumulocity API is not working even if we have changed the owner of child device from user that created the child device by API call to the owner of the thin-edge.

Test Output:
The output of publishing the events to the child devices that are created using cumulocity API with owner renamed to the thin-edge is that the new child device of the same name that is provided in the API call with type “thinedgeio-child” is created and events are published to it.

Hi,

are you sure that the child device in your screenshot is a child device? Usually you would see in the parent device the “child devices” tab. I do not see that tab in your screenshot.

image

Could you post the REST API Calls you made to create the child device and also the mqtt messages (incl. topics) that you use for sending the events?

Hello,

The screenshot that I have sent you in the last message was the device info view in of the child device.

Process followed to create child device from REST API calls.

Create Camera Child Device
Post: {{url}}/inventory/managedObjects?Content-Type=application/vnd.com.nsn.cumulocity.managedobject+json&Accept=application/vnd.com.nsn.cumulocity.managedobject+json
Authorization: Inherited from Parent

Body:
{
“name”: “MCS02I502” ,
“type”: “FP.Device.Camera”
{
“manufacturer_Details”:{
“date_Implememntation”:“”,
“date_Manufacturing”:“”,
“date_Expiring”:“”

    },
"credentials":{
    "username":"",
    "password":"",
    "key":""


}

{
“c8y_Hardware”: {
“revision”: “”,
“model”: “”,
“serialNumber”: “”
}
}

}

Linking Camera to Parent Device.
POST: {{url}}/inventory/managedObjects/{{deviceId}}/childDevices?Accept=application/vnd.com.nsn.cumulocity.managedobject+json&Type=application/vnd.com.nsn.cumulocity.managedobject+json

Authorization: Inherited from Parent
Body:
{
“managedObject”: {“id”:“1983114”}

Topics and Events from Thin Edge

MicrosoftTeams-image (6)

The mentioned topic here is creating new child device with type thin-edge and publishing events to it instead of already present child device created by the API call.

You send the event to: tedge/events/UDI-Childevents/MCS02I502

Is MCS02I502 the external ID of your child device? Because you are creating the child device, linking it but I do not see the call where you do set the external ID. Could you show the Identity tab section of that device?

The MCS021502 is the name of the child device that is created from the cumulocity. When we are trying to are to publish the events from thin-edge to this child device, the new child device of same name and different Id is created.

We have deleted the MCS021502 child device. But we have created new test child device following the mentioned procedure of child device creation.

Here is the screen shot of the identity tab of test child device.

I think you uploaded the same pictures as before. Could you upload the image with the open identity tab?

The below picture consists of the identity tab of the new child device which is created from the thin edge.

And how does it look from the child device that you created via API´s yourself?

The below picture consits of the identity tab of the new child device created from the API

That’s the issue. If you create the child device via API yourself you also have to give it an externalID. Since you did not do that, thin-edge.io (more precise the MQTT Broker) does not know to which child device you want to send the data.

If you create a child device you have to perform 3 Rest Calls:

  1. Create Device
    image

  2. Add external Identifier
    image

  3. Add Parent Device
    image

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.