As you have read the title, my problem is that I cannot add Sinric pro to the below code. Im trying to create a AC remote which can be controlled via Blynk and Alexa. I’m Trying to access the blynk using alexa, Most of might probably recommend IFTTT but due to corporate greed IFTTT is reducing the free plan’s functionality to 2 applets which is not enough for my project.
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
const int ledPin = 12;
const int ledPin2 = 13;
const uint16_t kIrLed = 4; // ESP8266 GPIO pin to use. Recommended: 4 (D2).
IRsend irsend(kIrLed); // Set the GPIO to be used to sending the message.
#define auth ""
char ssid[] = "";
char pass[] = "!";
// AC control pin
void setup() {
irsend.begin();
Serial.begin(115200);
Blynk.begin(auth, ssid, pass);
pinMode(ledPin, OUTPUT);
pinMode(ledPin2, OUTPUT);
}
void loop() {
Blynk.run();
}
BLYNK_WRITE(V1) {
int powerState = param.asInt();
if (powerState == 1) {
irsend.sendLG(0x8800C40, 28);
digitalWrite(ledPin, HIGH);
delay(500); // Adjust the delay if necessary
} else {
irsend.sendLG(0x88C0051, 28);
delay(500); // Adjust the delay if necessary
digitalWrite(ledPin, LOW);
}
}
BLYNK_WRITE(V2) {
int temperature = param.asInt();
// Convert the desired temperature to the corresponding IR command
unsigned long irCommand = 0;
if (temperature == 18) {
irCommand = 0x880834F;
} else if (temperature == 19) {
irCommand = 0x8808440;
} else if (temperature == 20) {
irCommand = 0x8808541;
} else if (temperature == 21) {
irCommand = 0x8808642;
} else if (temperature == 22) {
irCommand = 0x8808743;
} else if (temperature == 23) {
irCommand = 0x8808844;
} else if (temperature == 24) {
irCommand = 0x8808945;
} else if (temperature == 25) {
irCommand = 0x8808A46;
} else if (temperature == 26) {
irCommand = 0x88C0051;
} else if (temperature == 27) {
irCommand = 0x8808C48;
} else if (temperature == 28) {
irCommand = 0x8808D49;
} else if (temperature == 29) {
irCommand = 0x8808E4A;
} else if (temperature == 30) {
irCommand = 0x8808F4B;
}
irsend.sendLG(irCommand, 28);
}
BLYNK_WRITE(V3) {
int timer = param.asInt();
// Convert the desired timer value to the corresponding IR command
unsigned long irCommand = 0;
if (timer == 1) {
irCommand = 0x88A03C9;
} else if (timer == 2) {
irCommand = 0x88A0789;
} else if (timer == 3) {
irCommand = 0x88A0B49;
} else if (timer == 4) {
irCommand = 0x88A0F09;
} else if (timer == 5) {
irCommand = 0x88A12C9;
} else if (timer == 6) {
irCommand = 0x88A1689;
} else if (timer == 7) {
irCommand = 0x88A1A49;
} else if (timer == 8) {
irCommand = 0x88A000A;
}
irsend.sendLG(irCommand, 28);
}
BLYNK_WRITE(V4) {
int energysaverstate = param.asInt();
if (energysaverstate == 1) {
irsend.sendLG(0x88C0095, 28);
digitalWrite(ledPin2, HIGH);
delay(500); // Adjust the delay if necessary
} else {
irsend.sendLG(0x88C0095, 28);
digitalWrite(ledPin2, LOW);
delay(500); // Adjust the delay if necessary
}
}