Hello I am new to cumulocity and need help for the following scenarios
- I am trying to create a child device with following code:
public static void main(String[] args) {
final MqttConnectOptions connOpts = new MqttConnectOptions();
connOpts.setUserName(TENANT + "/" + USERNAME);
connOpts.setPassword(PASSWORD.toCharArray());
final MqttClient client;
try {
client = new MqttClient(SERVERURL, CLIENTID, null);
client.connect(connOpts);
client.publish("s/us", ("100," + DEVICE_NAME + ",c8y_MQTTDevice").getBytes(), 2, false);
// set device's hardware information
client.publish("s/us", "110,101010203,MQTT test model,Rev0.1".getBytes(), 2, false);
//create Child device
client.publish("s/us", ("101, 9999,ivelin13, c8y_MQTTChildDevice").getBytes(), 2, false);
} catch (
MqttException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
The above code creates child device but i want to set it- hardware information. The template for that operation is
110,serialNumber,hardwareModel,revision
But i could not find how to set hardware information on the current child device. Maybe i have to select that child device- but i don't know how?
- Also i want to sent temperature measurement to the current child device. How do I select a child device?
Thanks in advance