React

Reacts allow you to trigger a ThingHTTP request or send a tweet using ThingTweet when your ThingSpeak Channel meets a certain condition. For example, you can have your thermostat turn on by the time you get home from work by creating a Geo Location React. You could post a Twitter status when your power use is higher than normal by creating a Numeric React. You can create lots of different reactions to sensor data with the React, a ThingSpeak App.




Create a React


  • Select Apps
  • Select React
  • Click “Create New React”
  • Select your React condition, test frequency, action, options
  • Click “Create React”


Condition Types

Since a ThingSpeak Channel can hold numeric sensor data, text, strings, status updates, and geo location information, you can create different types of conditions for your channel.

String

Use this condition type to test a text string in a ThingSpeak Channel Field. For example, “If Channel 1, Field 1, is equal to blue, then set my light to blue.”

Here are the following checks that you can make on the data when you are testing for strings:

  • contains
  • starts with
  • ends with
  • is equal to
  • is not equal to

Status

Use this condition type to test a ThingSpeak Status inside of Channel. The status field is similar to the text inside of a Tweet on Twitter. You can search the status for a word and then send a ThingHTTP request when the test is valid.

Here are the following checks that you can make on the data when you are testing the ThingSpeak Status of a channel:

  • contains
  • starts with
  • ends with
  • is equal to
  • is not equal to

Numeric

Use this condition type when you have sensor data or numeric data in the fields of a ThingSpeak Channel. For example, if your power use is over 300 Watts, then you can post to Twitter, “I am using too much power” using a Numeric React. You could also use this to send a control command to another service or device that accepts an HTTP request.

Here are the following checks that you can make on the data when you are testing numbers in a ThingSpeak Channel Field:

  • is greater than
  • is greater than or equal to
  • is less than
  • is less than or equal to
  • is equal to
  • is not equal to

Geo Location

Use this condition type when you want to check the location fields inside of a ThingSpeak Channel. You could have a mobile app reporting your latitude and longitude to a ThingSpeak Channel, and when your position is within a certain distance of your house, turn on your living room lights.

Here are the following checks that you can make on the data when you are testing location information a ThingSpeak Channel:

  • is within
  • is farther than

No Data Check

Use this condition type when you want to check if data is being published to a ThingSpeak Channel. Sometimes your device stops working, because of a power outage, so this react can check to see if your channel is being updated. If it is not being updated, you can cause an action to fire. You can specify the amount of time that your channel is not being updated before an action gets triggered.



Test Frequency

You can test your condition on every insert or on a periodic basis. Select one of the following options to test your condition:

  • On Data Insertion
  • Every 10 minutes
  • Every 30 minutes
  • Every 60 minutes



Action

You can trigger a ThingHTTP request or send a Twitter update using the ThingTweet app. Using ThingHTTP as the action of a React, allows you lots of flexibility on what you want to cause to happen when your Channel meets a certain condition.




Replacements

If you specify, %%trigger%% in your ThingHTTP request or ThingTweet message, %%trigger%% will be replaced with the value that triggered your React. Your tweet could be, “It is way too hot in here at %%trigger%%C”. You can also add the Channel ID attached to the React by using %%channel_id%% as a replacement.



Options

  • Run action only the first time the condition is met - trigger the action if the condition was previously false and is currently true
  • Run action each time condition is met - trigger the action the action every time that the condition is true



Getting Support for Reacts


Please post your questions in the Apps section of the ThingSpeak Forum.