I am logging the level of a fluid tank using a Node MCU and posting the details to ThingSpeak server. Working fine the last two years.
Now I would like to get a E-Mail when the fluid level drops below a threshold and since this is not easy to do with Thingspeak, thought why not use the IFTTT ?
Can someone point me to a article or tutorial on a similar project ? I am also studying the various such projects but most of them either send a Tweet or interface with Alexa or Google Home.
Edit …
I have located a code and tried it … all configurations on IFTTT and the code below compile and run OK. However I am not getting any mail …. so what could be wrong ?
//Code for the www.MakeUseOf.com Wi-Fi connected Button tutorial by Ian Buckley
#include <IFTTTWebhook.h>
#include <ESP8266WiFi.h>
#define ledPin 2
#define wakePin 16
#define ssid "myssid"
#define password "mypwd"
#define IFTTT_API_KEY "mykey"
#define IFTTT_EVENT_NAME "RR_PushButton"
void setup() {
Serial.begin(9600);
while(!Serial) {
}
Serial.println(" ");// print an empty line before and after Button Press
Serial.println("Button Pressed");
Serial.println(" ");
connectToWifi();
IFTTTWebhook hook(IFTTT_API_KEY, IFTTT_EVENT_NAME);
hook.trigger();
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
delay(200);
digitalWrite(ledPin, LOW);
ESP.deepSleep(wakePin);
}
void connectToWifi() {
Serial.print("Connecting to: NAME "); //uncomment next line to show SSID name
Serial.print(ssid);
WiFi.begin(ssid, password);
Serial.println(" ");
Serial.print("Attempting to connect: ");
//try to connect for 10 seconds
int i = 10;
while(WiFi.status() != WL_CONNECTED && i >=0) {
delay(1000);
Serial.print(i);
Serial.print(", ");
i--;
}
Serial.println(" ");
//print connection result
if(WiFi.status() == WL_CONNECTED){
Serial.print("Connected.");
Serial.println(" ");
Serial.print("NodeMCU ip address: ");
Serial.println(WiFi.localIP());
}
else{
Serial.println("Connection failed - check your credentials or connection");
}
}
void loop(){
//if deep sleep is working, this code will never run.
Serial.println("This should never get printed");
delay(1000);
}