ThingSpeak

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

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, TalkBack, and ThingTweet.

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.

p

You can use React to trigger ThingTweet to tweet about the failure. In addition to the tweet, you can also use React to trigger TalkBack to issue the command to the boiler system to shut it down. While React can directly trigger ThingTweet and 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 as shown in this diagram:

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 and ThingTweet. TalkBack commands the boiler to shut down and ThingTweet notifies you about the channel inactivity via a tweet.

ThingHTTP_APIKEYS = struct('To_Trigger_TalkBack','HS6DRAPRIEXPFRBJ','To_Trigger_ThingTweet','SPV1RUX5BM312OHD');% Your ThingHTTP app API keys
url = 'https://api.thingspeak.com/apps/thinghttp/send_request';
Trigger_TalkBack = webread(url,'api_key',ThingHTTP_APIKEYS.To_Trigger_TalkBack) %Trigger TalkBack via ThingHTTP
Trigger_ThingTweet = webread(url,'api_key',ThingHTTP_APIKEYS.To_Trigger_ThingTweet) %Trigger ThingTweet via ThingHTTP
Trigger_TalkBack =

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


Trigger_ThingTweet =

1

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:

Configure ThingHTTP to trigger the ThingTweet app to tweet about the channel inactivity. The api_key is your ThingTweet API key and the status is the tweet message.

The ThingTweet app linked to your Twitter account now tweets as shown,

Related Topics

Was this topic helpful?