Hi; I started into using ESP8266 as an IR remote to control my Gree Aircon from my phone via thinger and also to add conditional functionalities by employing IFTT. My remote is using a non-standard NEC protocol so I’m still making use of the raw send approach. Soon enough; I intend to add room temperature control and other feedback mechanism. For now, this is just a POC.
int IR_PIN = 2; //GPIO02
bool SWITCH = LOW;
ThingerWifi thing(USERNAME, DEVICE_ID, DEVICE_CREDENTIAL);
IRsend irsend(IR_PIN);
unsigned int rawCodes[] = {8996,4480,644,1652,644,556,644,556,640,1656,640,560,644,1652,640,1656,640,560,668,532,668,532,664,540,640,560,640,560,640,536,664,564,612,588,612,588,616,588,612,588,612,560,640,588,612,1684,620,1676,648,552,672,528,676,524,648,556,648,552,648,1648,648,552,648,1648,648,552,648,552,648,1648,648,552,648,19928,676,1648,644,556,644,556,648,552,648,556,644,556,648,552,648,552,648,556,648,552,648,552,648,552,648,552,652,1644,648,552,648,556,648,552,648,552,648,556,644,556,648,552,644,556,648,552,648,556,644,556,648,552,648,552,648,556,648,1644,648,556,644,1648,652,552,648};
int code = 0;
//sizeof(rawCodes)/sizeof(int)
void setup() {
irsend.begin();
Serial.begin(115200);
delay(200);
thing.add_wifi(SSID, SSID_PASSWORD);
thing["switch"] << inputValue(SWITCH,{
/* here you could even attach/detach the interruption based on the updated NOTIFICATION
value, turn off the PIR sensor, etc., but it is not really necessary */
if (!SWITCH) {
Serial.println("Siwtch off");
}
else {
Serial.println("Siwtch on");
irsend.sendRaw(rawCodes, 139, 38);
}
});
}
void loop() {
thing.handle();
}