Basically, I am getting temperature values and trying to send an email alert whenever the temperature exceeds a specific point.
But however the code runs but yet I am facing an error that says
Error using matlab.internal.webservices.HTTPConnector/copyContentToByteArray (line 373)
The server returned the status 429 with message "Too Many Requests" in response to the request to URL https://api.thingspeak.com/alerts/send.
Error in readContentFromWebService (line 46)
byteArray = copyContentToByteArray(connection);
Error in webwrite (line 139)
[varargout{1:nargout}] = readContentFromWebService(connection, options);
Error in Customer Temperature Email Trigger (line 10)
webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options);
I am also attaching the code.
alertApiKey = 'PRIVATE_ALERT_API_KEY';
alertUrl="https://api.thingspeak.com/alerts/send";
options = weboptions("HeaderFields", ["ThingSpeak-Alerts-API-Key", alertApiKey ]);
temperature = thingSpeakRead(channelID,'NumDays',30,'Fields',1);
recentvalue = temperature(end)
alertSubject = sprintf("Temperature Alert");
alertBody = sprintf(" The temperature of the customer entering the store is high : ",recentvalue);
webwrite(alertUrl , "body", alertBody, "subject", alertSubject, options);
Basically the other articles tell me that I have to enter a delay or a pause because the free version of thingspeak has limitations. Any idea on what I could do to make sure the code runs with minimal amount of delay?