I have a problem with the email endpoint. I can’t get it to work properly.
When the requirement to activate the endpoint is met, I only receive the mail sometimes. For example, out of 10 times that I activated the trigger manually, I only received the email once.
I have a flow meter that I use to confirm that the sprinkler system has been activated. I don’t need to send any data in the body of the email. I just need the mail to arrive confirming that the irrigation has been carried out.
The endpoint is created correctly in Thinger.io because sometimes I get the mail. The code I use is the following:
if(valor_sensor[4] != 0){
Serial.println("Caudal distinto de cero");
thing.call_endpoint("email_caudal");
}
Hi,
I guess you need to control how often is the endpoint called, as is coded, when valor_sensor[4] != 0 it will call the endpoint as fast as it can, more than 1000 times in a second, so the server surely will block the device.
WIth the boolean sendMail flag, it will call the endpoint just once, you just need to set the flat to 1 in other part of the code, by another condition , for example valor_sensor[4] == 0 or by time, or a combination.
Hello,
I have tried what you have suggested to me to use a boolean variable to ensure that the send only occurs once and the same thing keeps happening to me. It does not send the email most of the times the event is activated and sometimes when it is activated the email is received a few hours later.
This code snippet only runs once when I send the data to thinger.
int myNum = valor_sensor[4].toInt();
if(myNum != 0){
Serial.println(myNum);
Serial.println(“Caudal distinto de cero”);
thing.call_endpoint(“caudal”);
}
And this is the output that the sketch produces with the thinger DEBUG active.