Hi all,
I have an Arduino Uno R4 WiFi board with multiple relay, temperature, humidity and pressure sensors successfully connected to Arduino IOT Cloud services. I would like to generate an email alert under a certain condition, for example high pressure value.
Arduino has the ability to attached a Webhook to a Thing. However, on every change of each variable within the Thing, it triggers the IFTTT Webhook and very quickly exceeds the 30 email limit. It is not possible to attach a Webhook to a variable or a combination of Thing and variable currently.
@arduino support: Is this in your future roadmap?
I was able to find some example code, I thought that may help, however, I believe that the Ethernet object is not fully associated to the Arduino (WiFiConnectionHandler ArduinoIoTPreferredConnection(SSID, PASS); ) and as such does not work.
When this code triggers, it returns Connection failed...
I feel like I need an Arduino IOT Cloud example on how to connect to IFTTT and not an EthernetClient!
/*
==============================================================================
IFTTT
==============================================================================
*/
#include <SPI.h>
#include <Ethernet.h>
int HTTP_PORT = 80;
String HTTP_METHOD = "GET";
char HOST_NAME[] = "maker.ifttt.com";
String PATH_NAME = "/trigger/send-email/with/key/XXXXXXXXXXXXXXXXXXXX";
String queryString = "?value1=33.5";
// https://maker.ifttt.com/trigger/send-email/with/key/XXXXXXXXXXXXXXXXXXXX?value1=31.2
EthernetClient client;
if (iWiFiStatus == WL_CONNECTED) {
if (client.connect(HOST_NAME, HTTP_PORT)) {
DebugSerialPortAlways.println(F("Successfully connected to server..."));
client.println("GET " + PATH_NAME + queryString + " HTTP/1.1");
client.println("Host: " + String(HOST_NAME));
client.println("Connection: close");
client.println();
while (client.connected()) {
if (client.available()) {
char c = client.read();
DebugSerialPortAlways.print(c);
}
}
client.stop();
DebugSerialPortAlways.println();
DebugSerialPortAlways.println(F("Successfully disconnected..."));
} else {
DebugSerialPortAlways.print(F("Connection failed to establish @ "));
DebugSerialPortAlways.print(HOST_NAME);
DebugSerialPortAlways.print(F(" "));
DebugSerialPortAlways.print(HTTP_PORT);
DebugSerialPortAlways.print(F(" "));
DebugSerialPortAlways.print("GET " + PATH_NAME + queryString + " HTTP/1.1");
DebugSerialPortAlways.println(F(" ..."));
}
}
Any support and guidance as to how best handle would be greatly appreciated.
Many thanks,
Mike
Note: This is my first post, so hopefully posted within the correct area of the forum!