Skip to main content
1-Visitor
December 20, 2016
Question

How to Copy Configuration from template to thing

  • December 20, 2016
  • 3 replies
  • 2331 views

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.

3 replies

1-Visitor
December 20, 2016

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

1-Visitor
December 20, 2016

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

tayyasamy1-VisitorAuthor
1-Visitor
December 20, 2016

Thanks Dinesh.

I tried without params to GetConfigurationTables service and got some exception. Anyway, your solution fixed it. Thanks a lot.

5-Regular Member
December 21, 2016

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