HW: ESP8266
OS: Android 10
Latest Blynk Lib
Background:
I am using a ESP8266 IR remote to turn on my light, tv and air conditioner.
I did this back in 2018, but i found there is Blynk now and would like to switch to Blynk for the implementation.
Since my device only have 2M of memory, i could not store all the raw data of IR in the Arduino, therefore i use google apps script(GAS) to send the IR raw data to the Arduino.
Q1:
Currently I update pin V1 to receive the IR raw data from GAS by sending a PUT webhook.
This is perfect for Light and TVs. But when it comes with Air Condition, I face the issue that the data was too large and my device crash.
The data is as the following.
aircon&439=3550, 1668, 506, 364, 532, 1206, 506, 360, 536, 334, 506, 364, 530, 334, 510, 360, 506, 364, 506, 360, 510, 360, 506, 364, 506, 360, 506, 364, 532, 1206, 506, 364, 506, 360, 510, 360, 506, 364, 506, 360, 504, 364, 506, 364, 506, 1232, 504, 1232, 506, 1232, 510, 360, 532, 338, 532, 1206, 506, 364, 506, 360, 506, 364, 532, 334, 536, 336, 506, 364, 506, 360, 506, 364, 506, 360, 510, 360, 532, 338, 506, 360, 506, 364, 506, 364, 506, 360, 506, 366, 506, 360, 506, 364, 506, 360, 510, 360, 506, 364, 506, 360, 536, 334, 532, 338, 506, 360, 536, 334, 506, 360, 510, 360, 506, 364, 506, 360, 510, 1228, 510, 1230, 532, 334, 510, 360, 506, 360, 536, 278, 562, 364, 532, 9874, 3556, 1662, 510, 360, 506, 1232, 510, 360, 506, 364, 506, 360, 506, 364, 506, 360, 510, 360, 506, 360, 510, 360, 506, 364, 506, 364, 506, 360, 506, 1232, 510, 360, 506, 360, 536, 334, 510, 360, 506, 360, 510, 360, 506, 364, 506, 1232, 506, 1230, 506, 1230, 510, 360, 506, 364, 506, 1232, 506, 360, 510, 360, 506, 364, 506, 360, 510, 360, 506, 360, 510, 360, 506, 286, 610, 334, 510, 360, 506, 360, 510, 360, 506, 366, 532, 334, 506, 364, 532, 1206, 506, 1232, 536, 334, 506, 364, 532, 334, 506, 364, 506, 360, 536, 334, 506, 364, 506, 360, 510, 1232, 530, 1206, 532, 334, 510, 360, 510, 360, 506, 360, 506, 366, 532, 334, 536, 334, 506, 364, 506, 360, 506, 1232, 536, 1206, 532, 1206, 506, 1232, 506, 1232, 510, 360, 506, 1232, 510, 360, 506, 1230, 506, 1232, 536, 334, 506, 1232, 506, 1230, 510, 360, 506, 364, 506, 360, 510, 360, 532, 334, 510, 360, 506, 360, 510, 360, 506, 366, 506, 364, 506, 360, 506, 364, 532, 334, 510, 1232, 532, 1206, 506, 1232, 506, 364, 506, 360, 536, 334, 532, 338, 532, 334, 510, 362, 530, 340, 506, 360, 506, 364, 506, 1232, 506, 1232, 510, 1232, 506, 360, 506, 360, 510, 360, 510, 360, 506, 360, 510, 360, 506, 364, 506, 360, 510, 360, 506, 360, 510, 360, 506, 364, 506, 360, 510, 360, 532, 334, 510, 360, 506, 1232, 506, 364, 506, 1232, 510, 1226, 510, 360, 506, 360, 510, 360, 506, 1232, 510, 360, 532, 338, 506, 360, 506, 364, 532, 1206, 506, 1232, 510, 1228, 510, 360, 510, 360, 506, 360, 510, 1232, 506, 360, 510, 360, 506, 366, 506, 360, 506, 364, 506, 1230, 506, 364, 506, 1230, 506, 1230, 536, 334, 506, 1232, 506, 1232, 510, 360, 506
when using Serial.println to print this data out, I got a SW WDT reset.
If i don’t print then the code use this data to send also crash.
I have set BLYNK_MAX_READBYTES to 4096 already as i look through the community.
I have also checked this data, it appears to be about 2256 Bytes.
Is there anyway i can use data as it is?
function that processing the IR Raw Data was the same as before i use Blynk.
Q2:
Since i could not send the data like the above method.
I tried another method to set V2 as a webhook and while received “aircon” string i call
Blynk.virtualWrite(V2, "https://GASwebhook/exec");
calling this seems to be fine. I set the URL and GET method with content type as Text/plain.
I could receive some data. But it’s not my IR raw data, instead is a html code.
Seems to be i need to request for the body of the GET response data.
How do i do that.
PS. Just for reference.
I used to use the following piece of code to get the IR raw data from GAS, and the aircon raw data was able to process.
String doRedirectGet()
{
HTTPSRedirect* client = nullptr;
String body = "";
client = new HTTPSRedirect(HTTPS_PORT);
if (!client->connect(HOST, HTTPS_PORT)) {
Serial.println("connection failed");
return body;
}
client->GET(URL, HOST);
body = client->getResponseBody();
delete client;
client = nullptr;
return body;
}