5 Replies Latest reply on Jan 5, 2017 12:28 PM by pchung RSS
    bkumar-3 Newbie

    Show multiple things on one mashup

    I have multiple things with same properties, one of the properties is location(base type: Location) . I want to create one mashup with google map, that should list all the locations of all the things plotted in the map.

     

    And i am using pre-built "MQTT" thing template, which leaves me that i cannot add services to the thing template.

     

    Please advise.

      • Re: Show multiple things on one mashup
        pchung Collaborator

        You can create a Thing based on that Template to which you can add services.

        You can also create a 'generic thing' to create services.

         

        These services will 'wrap' invoke the MQTT services as needed to compile the data.

        OR your MQTT transactions will provide data to your Things and your services retrieve information from those Things.

         

        At the end of that you'll need some infotable of locations that you can assign to the google map widget.

          • Re: Show multiple things on one mashup
            bkumar-3 Newbie

            Thanks Pai Chung.

             

            Can you help me in creating the service that collects all the things info.

             

            ALL Things have  properties

            1. location - LOCATION

            2. datavalue - float

              • Re: Show multiple things on one mashup
                pchung Collaborator

                Usually all these Things are based on the same ThingTemplate.

                You can create a Service that invokes ThingTemplates['nameofthetemplate'].QueryImplementingThingsWithData

                Then pair that with a DataShape that has the fields name, location and datavalue

                  • Re: Show multiple things on one mashup
                    bkumar-3 Newbie

                    Yeah all my things are based on same thing template.

                     

                    I created a new Thing called "master_thing". And i am adding a service, selected Entities as MQTT(Thing Template) . look at the screenshot for reference

                     

                    Screen Shot 2017-01-05 at 8.41.19 pm.png

                     

                    var params = {

                      maxItems: undefined /* NUMBER */,

                      nameMask: undefined /* STRING */,

                      query: undefined /* QUERY */,

                      tags: undefined /* TAGS */

                    };

                    // result: INFOTABLE dataShape: RootEntityList

                    var result = ThingTemplates["MQTT"].QueryImplementingThingsWithData(params);

                     

                     

                    Giving a empty params {} like ThingTemplates["MQTT"].QueryImplementingThingsWithData({}); will give all things And i need to define a query in params if i want to filter is what my assumption .

                     

                    You said "Then pair that with a DataShape that has the fields name, location and datavalue" this what im confused right now. Should i create datashape with properties like location, datavalue? Can you explain this part alone , it ll be very helpful if im able show all locations of all things .

                     

                     

                      • Re: Show multiple things on one mashup
                        pchung Collaborator

                        You'd set your Service Output to InfoTable then for the mashup to be able to successfully use the data, it needs an associated DataShape.

                        The DataShape defines what information you want to use in the Mashup and it has to match up with the fields you are producing in your service.

                        When you have your result set and the service saved (even without the DataShape) you can click on TEST to have the service run within Composer.

                        Once that is done, you can click on Create DataShape from Results to get your datashape, but it probably will have a lot more fields than you need.