Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X
An Event is a custom-defined message published by a Thing, usually when the value of a Property changes. A Subscription listens for a specific Event, then executes Javascript code.
In this step, you will create an Alert which is quick way to define both an Event and the logic for when the Event is published.
Create an Alert that will be sent when the temperature property falls below 32 degrees.
NOTE: This will cause the Alert to be sent when the temperature property is at or below 32.
8. Click ✓ button above the new alert panel.
9. Click Save.
Create a Subscription to this event that uses Javascript to record an entry in the error log and update a status message.
Follow the steps below to create code that sets the message property value and writes a Warning message to the ThingWorx log.
me.message = "Warning: Below Freezing";
2. Click the Snippets tab.
NOTE: Snippets provide many built-in code samples and functions you can use.
3. Click inside the Script text box and hit the Enter key to place the cursor on a new line.
4. Type warn into the snippets filter text box or scroll down to locate the warn Snippet.
5. Click All, then click the arrow next to warn, and Javascript code will be added to the script window.
6. Add an error message in between the quotation marks.
logger.warn("The freezeWarning subscription was triggered");
7. Click Done.
8. Click Save.
ThingWorx you can create customized web applications that display and interact with data from multiple sources. These web applications are called Mashups and are created using the Mashup Builder. The Mashup Builder is where you create your web application by dragging and dropping Widgets such as grids, charts, maps, buttons onto a canvas. All of the user interface elements in your application are Widgets. We will build a web application with three Widgets: a map showing your house's location on an interactive map, a gauge displaying the current value of the watts property, and a graph showing the temperature property value trend over time.
NOTE: The Google Map Widget has been provisioned on PTC CLoud hosted trial servers. If it is not available, download and install the Google Map Extension using the step-by-step guide for using Google Maps with ThingWorx .
6. Click and drag the Line Chart Widget onto the lower right area of the canvas.
7. Click Save
Click here to view Part 4 of this guide.