Main Content

Monitor and Act on Channel Inactivity Using ThingSpeak Apps

ThingSpeak™ provides apps to transform or visualize data or trigger an action. This example shows how to monitor your ThingSpeak channel activity using these ThingSpeak apps: React, MATLAB® Analysis, ThingHTTP, and TalkBack.

Consider a scenario where a pressure sensor monitors boiler pressure. The pressure sensor continuously feeds data to a ThingSpeak channel. If the channel stops receiving the pressure data, you receive notification about the event.

You can use React to trigger TalkBack to issue the command to the boiler system to shut it down. While React can directly trigger ThingHTTP, React cannot directly queue commands to TalkBack. Also, React cannot trigger multiple apps when it detects an event, but it can use MATLAB Analysis to trigger multiple apps.

Configure the React app to trigger MATLAB Analysis, when there is no activity in your channel for 15 minutes.

Configure MATLAB Analysis to trigger ThingHTTP, which in turn triggers the TalkBack. TalkBack commands the boiler to shut down.

Trigger_TalkBack = webread(url,'api_key',ThingHTTP_APIKEYS.To_Trigger_TalkBack) %Trigger TalkBack via ThingHTTP
Trigger_TalkBack =

{"id":1543695,"command_string":"SHUTDOWN\r\n","position":7294,"executed_at":null,"created_at":"2016-05-17T15:37:38Z"}

The output shows the response from the ThingHTTP app that triggers TalkBack to shut down the boiler system.

Configure ThingHTTP to trigger TalkBack to shut down the boiler. The api_key is your TalkBack API key, and the command is the command_string, which shuts down the boiler system.

You can see the added commands in the TalkBack queue shown here:

Related Topics