ESP and IFTTT
Posted: Sat Aug 25, 2018 11:45 am
Hello,
I have an esp-07 and I try to activate an applet on ifttt. I made several version of the program but none of them seems to work and I dont understand why.
I connect to wifi, I am able to post data on thingspeak but when I want to execute an applet on ifttt it does not work and I don't have any error message.
I check with API tester and it works, it call the applet. I simplfied the code and here a version I use to debug:
(I replaced the ssid, password, eventname and ifttt_key)
The wifi connect, if I try on api tester the command : https://maker.ifttt.com/trigger/eventna ... /key/mykey it works and the header is:
POST /trigger/eventname/with/key/mykey HTTP/1.1
Host: maker.ifttt.com
Accept: */*
User-Agent: Rigor API Tester
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
So it seems what I am posting Is OK.
Does anyone see what I am doing wrong ?
Thanks for your help
I have an esp-07 and I try to activate an applet on ifttt. I made several version of the program but none of them seems to work and I dont understand why.
I connect to wifi, I am able to post data on thingspeak but when I want to execute an applet on ifttt it does not work and I don't have any error message.
I check with API tester and it works, it call the applet. I simplfied the code and here a version I use to debug:
(I replaced the ssid, password, eventname and ifttt_key)
Code: Select all
const char* ssid = "myssid";
const char* password = "password";
const char* host = "maker.ifttt.com";
void setup() {
Serial.begin(115200);
delay(100);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}
void loop() {
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}
Serial.print("Requesting POST: ");
// Send request to the server:
client.println("POST /trigger/eventname/with/key/mykey HTTP/1.1");
client.println("Host: maker.ifttt.com");
client.println("Accept: */*");
client.println("Content-Type: application/x-www-form-urlencoded");
client.print("Content-Length: 0");
delay(500); // Can be changed
if (client.connected()) {
client.stop(); // DISCONNECT FROM THE SERVER
}
Serial.println();
Serial.println("closing connection");
delay(5000);
}
The wifi connect, if I try on api tester the command : https://maker.ifttt.com/trigger/eventna ... /key/mykey it works and the header is:
POST /trigger/eventname/with/key/mykey HTTP/1.1
Host: maker.ifttt.com
Accept: */*
User-Agent: Rigor API Tester
Content-Length: 0
Content-Type: application/x-www-form-urlencoded
So it seems what I am posting Is OK.
Does anyone see what I am doing wrong ?
Thanks for your help