Community Tip - You can change your system assigned username to something more personal in your community settings. X
hi i'm SeonHo
I am preparing POC using MQTT extension.
I need to configure the Thing's Configuratoin to publish the data.
If i set the topic, Publish works well.
I want Topic to be automatically formatted like a Subscribe.
Or I want to add or modify configuratoin through the service.
Please reply.
thanks
Solved! Go to Solution.
i solved it through PTC Technical Support
and i attach code
//Add row to Mapping table in Configurationvar params = {
tableName: "Mappings" /* STRING */
};
// result: INFOTABLE dataShape: "undefined"
//DeviceID must be has "MQTTSubscriber" Thing template
var result = Things[DeviceID].GetConfigurationTable(params);
var newRow = new Object();
newRow.name = name;
newRow.publish = publish;
newRow.subscribe = subscribe;
newRow.topic = topic;
result.AddRow(newRow);
var params = {
configurationTable: result /* INFOTABLE */,
persistent: 1 /* BOOLEAN */,
tableName: "Mappings" /* STRING */
};
Things[DeviceID].SetMultiRowConfigurationTable(params);
make service using attached code
and you can check added row at Mappings table in Configuration
Please refer to the following article:
And this is an article for MQTT general use:
Um ... You have not figured out the point of my question.
I am aware of the general usage of MQTT
So I receive the data value through communication now
The solution I'm looking for is to configure the configuration table of the MQTT extension through the service
Or like a subscription, the name and property value of the thing will automatically be used as a topic for publishing.
Thank you for answer
i solved it through PTC Technical Support
and i attach code
//Add row to Mapping table in Configurationvar params = {
tableName: "Mappings" /* STRING */
};
// result: INFOTABLE dataShape: "undefined"
//DeviceID must be has "MQTTSubscriber" Thing template
var result = Things[DeviceID].GetConfigurationTable(params);
var newRow = new Object();
newRow.name = name;
newRow.publish = publish;
newRow.subscribe = subscribe;
newRow.topic = topic;
result.AddRow(newRow);
var params = {
configurationTable: result /* INFOTABLE */,
persistent: 1 /* BOOLEAN */,
tableName: "Mappings" /* STRING */
};
Things[DeviceID].SetMultiRowConfigurationTable(params);
make service using attached code
and you can check added row at Mappings table in Configuration