Modify the application model, enhance your UI, and add features to the house monitoring application to simulate a request as it might come from an end user. For this step, we do not provide explicit instructions, so you can use critical thinking to apply your skills. After completing the previous steps, your Mashup should look like this:
In this part of the lesson, you'll have an opportunity to:
Add a garage to the previously-created house monitoring web application and include a way to display information about the garage in the UI. You will need to model the garage using Composer and add to the web application UI using Mashup Builder.
See below for some tips and hints that will help you think about what to consider when modifying the application in ThingWorx.
Modify your current house monitoring application by adding a garage:
Complete the task in your Composer before moving forward. The Answer Key below reveals how we accomplished this challenge so you can compare your results to that of a ThingWorx engineer.
Confirm you configured your Mashup to meet the enhancement requirements when extending your web application. Use the information below to check your work.
Creating a new Thing is one way to model the garage door. We explain other methods, including their pros and cons, in the Solution discussion below.
Review detailed steps for how to Create a Thing in Part 2 of this guide.
Any modeling strategy requires the addition of a new Property to your model. We explore options for selecting an appropriate base type for the garage Property in the Solution discussion on the next step.
Review detailed steps for how to Add a Property. in Part 1, Step 3 of this guide.
In order to display the garage door status, you must add a Widget to your Mashup. We used a check-box in our implementation. We introduce alternative display options in the Solution discussion on the next step.
Review detailed steps for how to Create an Application UI in Part 3, Step 8 of this guide.
If you created a new Thing, you must add a new data source. This step is not required if you added a Property to the existing Thing representing a house.
Review detailed steps for how to Add a Data Source to a Mashup in Part 4, Step 10 of this guide.
You must bind the new garage door Property to a Widget in order to affect the visualization.
If you want to inspect the entities as configured by a ThingWorx engineer, import this file into your Composer.
See below for some options to consider in your application development.
There are several ways the garage door property could be added to your existing model. The table below discusses different implementations we considered. We chose to model the status of the garage door as a Property of a new Thing created using the building Template.
Modeling Method | Pros | Cons |
Add Property to BuildingTemplate | The Garage property will be added to existing house Thing | All future Things using Building Template will have a garage door property |
Add Property to existing house Thing | House and garage are linked | No separate temperature and watts Property for garage |
Add Property to new Thing created with BuildingTemplate | All Building features available | No logical link between house and garage |
We chose to represent the status of the door with a simple Boolean Property named 'garageDoorOpen' Thoughtful property naming ensures that the values, true and false, have a clear meaning. Using a Boolean type also makes it easy to bind the value directly to a Widget. The table below explains a few Base Type options.
Modeling Method | Pros | Cons |
Boolean | Easy to bind to Widget | Information between open and closed is lost |
Number | Precise door status | Direction information is lost |
String | Any number of states can be represented | An unexpected String could break UI |
We chose a simple Check-box Widget to show the garage door status, but there are many other Widgets you could choose depending on how you want to display the data. For example, a more professional implementation might display a custom image for each state.
We recommended that you check the Logged option, so you can record the history of the garage door status.
Congratulations! You've successfully completed the Get Started with ThingWorx for IoT tutorial, and learned how to:
The next guide in the Getting Started on the ThingWorx Platform learning path is Data Model Introduction.