I tried to send emails from my email provider but I guess their server, at times, takes too long to answer so the blynk-cloud server is causing the script to crush with “BrokenPipeError: [Errno 32] Broken pipe”.
As a remedy, I tried blynk email but it only works when the app is on. Is there a way for the blynk server to send emails on the background?
TIA
The test code:
#!/usr/bin/env python3
import BlynkLib, time
BLYNK_AUTH = '**'
# Initialize Blynk
blynk = BlynkLib.Blynk(BLYNK_AUTH)
txt = ""
test = 1
def blynk_loop():
blynk.set_user_task(checkAC, 10000)
blynk.run()
def checkAC():
global txt
if(test == 1):
txt = "No AC line at: "
txt += time.strftime("%H:%M:%S")
blynk.email("me@gmail.com", "RPI",txt)
blynk.notify("No AC!!")
if __name__ == "__main__":
while True:
blynk_loop()
I ran a test code on an Arduino Yun and on minute 12 I turned off the app. The Yun kept sending the email messages to the cloud blynk server but I stopped receiving them. Then, on minute 21 I turned the app back on and kept receiving the emails again but lost the emails from minute 13 to minute 21.
Apparently, the problem is not Python lib related.
Yun test code:
#include <Bridge.h>
#include <BlynkSimpleYun.h>
char auth[] = "**";
BlynkTimer timer;
void sendemail()
{
Blynk.email("me@gmail.com", "Subject: my Yun", "Just a test...");
Console.println("Email sent.");
}
void setup()
{
Bridge.begin();
Console.begin();
Blynk.begin(auth);
Blynk.email("me@gmail.com", "Subject", "My Blynk project is online.");
timer.setInterval(60000L, sendemail); //check for opening time
delay(1000);
Console.println("Setup done...");
}
void loop()
{
Blynk.run();
timer.run();
}
Could you please confirm that emails from the blynk-cloud server are sent out only when the phone’s app is running even though the project is requesting the email to be sent out?
I tried the above test codes with the blynk-cloud and with a local server with no avail.