Thinspeak使用Matlab分析创建电子邮件警报

时间:2020-01-13 08:05:29

标签: matlab

我正在跟踪下面的链接https://www.mathworks.com/help/thingspeak/sendalert.html。基本上我遇到错误,请指定一个有效的读取API密钥,或者将频道设为公开以避免指定读取API密钥。我的频道是私人频道,我正在提供自己的Read API密钥,我可能会丢失什么?

data = thingSpeakRead(941028, "NumMinutes", 100);
aveTemp = mean(data(:,7));
apiKey = 'PFZRTJ2JYTXW519I';
alertURL = "https://api.thingspeak.com/alerts/send";
options = weboptions("HeaderFields",["ThingSpeak-Alerts-API-Key", apiKey]);
alertBody = sprintf("The temperature is %0.2fF.", aveTemp);

if avg_temperature > 60.0
    webwrite(alertURL, "body", alertBody, "subject", alertSubject, options);
end

0 个答案:

没有答案