Skip to main content
1-Visitor
December 5, 2017
Question

How can I connect alert to mashup

  • December 5, 2017
  • 9 replies
  • 4853 views

I have created a thing to detect the temperature. While displaying the temperature in mashup, I want to display an alert message everytime the temperature is in a certain range . I also want to deploy a colour according to the range of temperature.

For e.g

- if (temperature > 0 && temperature < 60)

   print ("the temperature is not that high")

And the colour should be "green"

- if (temperature > 60 && temperature < 80)

   print ("the temperature high")

And the colour should be "red"

How can I implement something like this!!

Thank you in advance.

9 replies

17-Peridot
December 5, 2017

For the alert, you can specify that in the property itself.  Edit the "temperature" property and select "Manage Alerts" and put the "Greater Than" alert on it.  Then under "Subscriptions" on the left, create a new subscription and tie it to the alert on that property (and then use scripting to perform some action).  If you want to drive a message and colors on a mashup, you can use a combination of a boolean that drives the "visibility" of a widget and state formatting of a shape or text.

kt11-VisitorAuthor
1-Visitor
December 6, 2017

Hey Nick,

Thank you for your reply. I tried doing what you said, but I am still not able to display the the message in the mashup.  Below is the method that I used,

1) This is what my Thing looks like:

2) This is my subscription

3) when I connect mashup to this subscription, it doesnot display any data.

17-Peridot
December 6, 2017

After reading your subscription script I think I have a better idea of what you’re trying to accomplish. In this case, change your subscription to “Data Change” and tie it to your temperature property. You can keep the same script you wrote. Now, anytime the temperature changes it will change the message accordingly. Now in your mashup, use the GetPropertyValuesService to have the “message” property available. Drag a Label widget into your workspace and tie the “message” property to it.