Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X
Hi,
I am trying to create thing using MQTTTemplate and configuration is done in Template Level. But, when i create things using CreateThing service, Configuration is empty. Anyone, please help.
Hi Thangavel Ayyasamy,
Actually this one copy the configuration from template to Things configuration.I think This one will help you to configure the thing configuration.
var params = {
tableName: "ConnectionInfo" /* STRING */ //this one was connection setting of MQTT
};
// config: INFOTABLE dataShape: "undefined"
var config = me.GetConfigurationTable(params);
//here config contain the mqtt template configuration details and push the configuration detail to set configuration details where you create the thing.
var params = {
configurationTable: config /* INFOTABLE */,
persistent: true /* BOOLEAN */,
tableName: "ConnectionInfo" /* STRING */
};
me.SetConfigurationTable(params);
Thanks
Dinesh S
Hi Thangavel Ayyasamy,
1) just create createThingService
2) On that service wrote the qurey of creating service first after that,
3) In entities tab, select your MQTT template
i) in template service choose the GetConfigurationTable service, pass parameter as "ConnectionInfo",
ii) use Things[params.name] ,which one dynamically create ThingName.
var params11 = {
configurationTable:config /* INFOTABLE */,
persistent: true /* BOOLEAN */,
tableName: "ConnectionInfo" /* STRING */
};
Things[params.name].SetConfigurationTable(params11);
4)execute the service
I Hope this one is more useful than I send before
Thanks
DINESH S
Thanks Dinesh.
I tried without params to GetConfigurationTables service and got some exception. Anyway, your solution fixed it. Thanks a lot.
If his answer helped you, you may want to mark it correct so others can more easily find the answer in the future.