Skip to content

Commit

Permalink
boot notification
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris McKeever committed Jul 31, 2020
1 parent 3960da5 commit cef13a8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions esp32/camera/motion-camera/v2-motion-camera/standard.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ void startWifi() {
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1);
}

void bootNotify() {

SMTPData smtp;
smtp.setLogin(smtpServer, smtpServerPort, emailSenderAccount, emailSenderPassword);
smtp.setSender("ESP32", emailSenderAccount);
smtp.addRecipient(emailAlertAddress);
smtp.setPriority("High");
smtp.setSubject("Device Boot: " + (String) deviceName);
smtp.setMessage("<div style=\"color:#2f4468;\"><h1>Hello World!</h1><p>- Sent from ESP32 board</p></div>", true);

if (MailClient.sendMail(smtp)) {
Serial.println("Boot Notification Sent");
} else Serial.println("Error sending Email, " + MailClient.smtpErrorReason());

smtp.empty();
}

void setTime() {
unsigned long nowLong;
timeval tv;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ void setup(void) {
initHTTP(80);
registerCameraServer(81);

bootNotify();

motionTimer.every(500, timedMotion);
}

Expand Down Expand Up @@ -69,7 +71,7 @@ void send(String path="") {
smtp.setSender("ESP32", emailSenderAccount);
smtp.addRecipient(emailAlertAddress);
smtp.setPriority("High");
smtp.setSubject("Motion Detected " + path);
smtp.setSubject((String) deviceName + " Motion Detected " + path);
smtp.setMessage("<div style=\"color:#2f4468;\"><h1>Hello World!</h1><p>- Sent from ESP32 board</p></div>", true);

if (path != "") {
Expand Down

0 comments on commit cef13a8

Please sign in to comment.