cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

How to Copy Configuration from template to thing

tayyasamy
1-Visitor

How to Copy Configuration from template to thing

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.

4 REPLIES 4
ds-21
7-Bedrock
(To:tayyasamy)

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

ds-21
7-Bedrock
(To:tayyasamy)

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.

ttielebein
14-Alexandrite
(To:tayyasamy)

If his answer helped you, you may want to mark it correct so others can more easily find the answer in the future.

Announcements


Top Tags