Email notification after 3 days drying plant

Martin on 10 Sep 2022
Latest activity Reply by Christopher Stapels on 19 Sep 2022

Help us please, we need to send email after measurement from sonde (GSM report) is under limit for three days.
"React" on the limit, is non for three days under limit., and time control is days or weeks runner.
I propose trigger on time control but what is the code?
????
% Read the recent data.
moistureData = thingSpeakRead(channelID,'NumDays',3,'Fields',1); {is that right, that I read last three days measurement (3000x)?}
% Check to make sure the data was read correctly from the channel.
if isempty(moistureData)
alertBody = ' No data read from plant. ';
else
%{need if
% moistureData is for three days under limit from sonde then send
% email}
span = max(moistureData) - min(moistureData);
dryValue = span;
% Get the most recent point in the array of moisture data.
lastValue = moistureData(end);
% Set the outgoing message
if (lastValue<=dryValue)
alertBody = ' I need water! ';
elseif (lastValue>dryValue)
alertBody = ' No water needed. ';
end
really thanks so much
Martin
Martin on 13 Sep 2022
thanx for reply,
what i need is code for this> if for three days is received data {gprs upload} under "limit" {integer, change constant}, then send email.
How may I do this please?
Christopher Stapels
Christopher Stapels on 12 Sep 2022
Im sorry, im not quite clear on your question. Can you try to simplify what you need? Perhaps describe what will happen if you get the correct code set up.
Christopher Stapels
Christopher Stapels on 13 Sep 2022
If all the points for the last three days are under the limit, then send the alert?
I would calculate the max in the three days. If max is less than your limit, then all three days must be.
There is already code in what you shared above to calculate the maximum value.
Martin
Martin on 14 Sep 2022 (Edited on 14 Sep 2022)

let me ask you: is that right moistureData = thingSpeakRead(channelID,'NumDays',3,'Fields',1); the code read every data from fields1 for last three days? and please, how to send this max value in the email? really thank you, Martin

Christopher Stapels
Christopher Stapels on 19 Sep 2022
yes, that should work to get 3 days of data as long as there are less than 8000 points in those three days.
To send the max valuie in the email, add it to the variable alertBody.
Martin
1
Post
2
Replies