MATLAB Answers

Apps React ThingSpeak IoT says it has been triggered but my Matlab script does not generate an Alert email

4 views (last 30 days)
I am uploading data to a ThingSpeak channel from a Arduino MKR1010.
When I run my Matlab Analysis script from the Apps window it runs correctly reads and displays output and generates an Alert email.
I have set a React condition to a numeric field being uploaded.
When this field data meets the React condition the Last Ran time shows that the React file did run but it does not appear to run the Matlab Analysis script or if it does the script does not generate a Alert email.

Accepted Answer

Barnard Richards
Barnard Richards on 22 May 2021
Thanks all.
Scripts now working OK
My code logic was not working the way I intended and I also have a better understanding of the Alerts and Reacts

More Answers (4)


Vinod
Vinod on 19 May 2021
Most likely your MATLAB code is triggering the Alert API too frequently and is getting a HTTP 429 code. Take a look at the documentation for the Alerts API. You can also use the Alerts history API to understand more of what is going on.

Barnard Richards
Barnard Richards on 20 May 2021
Thanks Vinod,
I have now run the Alerts History. It appears to show the message is Sent but how do I determine if the specified Matlab script runs which should trigger an alert email.
Can the Output Window if open show the script output as a result of the Alert trigger?
(The ThingSpeak upload to my channel is each 30sec.)
How do I know if there is a HTTP 429 code?
I think my Matlab script is running as I coded it but not as I want! I will now review my code.
history_url =
"https://api.thingspeak.com/alerts/history"
history =
12×3 timetable
requestedAt sentAt subject status
____________________ ____________________________ __________________________ ________
19-May-2021 23:39:11 {'2021-05-20T03:39:16.913Z'} {'Hiking Toodyay' } {'sent'}
19-May-2021 23:38:52 {'2021-05-20T03:38:58.171Z'} {'Hiking Toodyay' } {'sent'}
19-May-2021 12:19:22 {'2021-05-19T16:19:27.449Z'} {'Plant soil information'} {'sent'}
19-May-2021 11:22:37 {'2021-05-19T15:22:43.477Z'} {'Plant soil information'} {'sent'}
19-May-2021 11:21:24 {'2021-05-19T15:21:30.066Z'} {'Plant soil information'} {'sent'}
19-May-2021 03:18:27 {'2021-05-19T07:18:33.557Z'} {'Plant soil information'} {'sent'}
18-May-2021 12:11:10 {'2021-05-18T16:11:15.756Z'} {'Plant soil information'} {'sent'}
18-May-2021 12:10:19 {'2021-05-18T16:10:24.796Z'} {'Plant soil information'} {'sent'}
17-May-2021 12:59:40 {'2021-05-17T16:59:45.288Z'} {'Plant soil information'} {'sent'}
17-May-2021 12:49:39 {'2021-05-17T16:49:45.528Z'} {'Plant soil information'} {'sent'}
17-May-2021 12:03:14 {'2021-05-17T16:03:19.544Z'} {'Hiking upload fail' } {'sent'}
17-May-2021 03:27:22 {'2021-05-17T07:27:28.750Z'} {'Hiking upload fail' } {'sent'}
  1 Comment
Christopher Stapels
Christopher Stapels on 20 May 2021
You can use the output window to monitor your script, but you may have to moidify the script. One suggestion is to remove a semicolon at the end of a line to see the output. For example, if you wrote
response=webwrite('url')
to trigger the email write, then you would see the value for response in the output window, unless you add a semicolon to the end of the line.
If you are triggering an alert every 30 seconds, you will definitely exceed the limit that you can see in the documentation that Vinod linked.

Sign in to comment.


Barnard Richards
Barnard Richards on 20 May 2021
Christopher Thanks for the output suggestion.
My Matlab script should only trigger once as the uploaded field 4 is incremented by +1 each 30 sec.
It only resets to zero if the MKR1010 is forced to restart.
But I now know my script logic used to respond to the Alert is not correct.

Communities

More Answers in the  ThingSpeak Community

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by