Open baykey opened 4 years ago
Welcome to HTTPSRedirect! Please provide enough info to debug the issue.
@baykey: It's still working for me. Here's an example:
#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"
const char* ssid = "<wifi ssid>";
const char* password = "<wifi password>";
const char* host = "script.google.com";
# A google sheets sheet with same script as in the repo GoogleScript.gs attached to it.
# Remember to publish as the README describes.
const char *GScriptId = "<your gscript id>";
const int httpsPort = 443;
// Write to Google Spreadsheet
String url = String("/macros/s/") + GScriptId + "/exec?value=";
String url2 = String("/macros/s/") + GScriptId + "/exec?";
String payload_base = "{\"command\": \"appendRow\", \
\"sheet_name\": \"<insert your sheet name here>\", \
\"values\": ";
String payload = "";
HTTPSRedirect* client = nullptr;
void setup() {
Serial.begin(9600);
Serial.flush();
Serial.println();
Serial.print("Connecting to wifi: ");
Serial.println(ssid);
// flush() is needed to print the above (connecting...) message reliably,
// in case the wireless connection doesn't go through
Serial.flush();
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() {
Serial.println("Sending");
bool ret = sendToSpreadsheet(1234);
Serial.println(ret);
delay(2000);
}```
In Arduino, the ESP8266 library should be Ver 2.5.2. This is what made it work for me. I have not tested on higher versions (2.6.3 is available as on today).
The library is still working fine. However, Google did make changes to their Script Editor. If you make changes to your Google Script, you must make a new deployment and update your ESP8266 code with the new Deployment ID (this was previously called the Script ID) in this line of code:
const char *GScriptId = "AKfycbzYw5G-oxvnwHpAJfDsS0PWNrO0KTBMiCW78lHUcEO6ZnFHvSw";
This was previously not the case as you could make a new deployment and not have to update the ESP8266 code. The Deployment ID is given to you when you create a new deployment, or can be found by going to Deploy > Manage Deployment
in the Script Editor.
I'm trying to connect to script.google.com and I keep getting 0 as return value on
int retval = client.connect("script.google.com", 443);
So I'm wondering if the library is still up, or if google changed something to its security.. (I've had several other examples fail because google changed something..