4 Replies Latest reply on Dec 21, 2016 12:44 PM by ttielebein RSS
    tayyasamy Explorer

    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.

      • Re: How to Copy Configuration from template to thing
        ds-2 Apprentice

        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

        • Re: How to Copy Configuration from template to thing
          ds-2 Apprentice

          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

          • Re: How to Copy Configuration from template to thing
            tayyasamy Explorer

            Thanks Dinesh.

             

             

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