Impossible to make https.get() request in plugin

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
CSCAYA
New user
Posts: 4
Joined: 25 Mar 2024, 13:02

Impossible to make https.get() request in plugin

#1 Post by CSCAYA » 25 Mar 2024, 13:23

Hi,

I'm writing a new plugin to get the data from the enphase gateway which can return the power produced by my solar panels.

This can be successfully done by using the sample script provided by the ESP8266HttpClient library (https://github.com/esp8266/Arduino/blob ... Client.ino) in which I make a https request on my gateway with ssl disabled (client->setInsecure()) and by adding some necessary headers.

The code works perfect when I compile it with arduino ide without espeasy, but when I use this code in my plugin ino file (PLUGIN_READ section), the http.get() still returns -1 when the plugin is reading.

Any ideas ?

Thanks !

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Impossible to make https.get() request in plugin

#2 Post by TD-er » 25 Mar 2024, 14:59

Yep, we don't (yet) support HTTPS in ESPEasy and I don't think it will be added to ESP8266 builds as we're struggling with build size and available memory. Both will face a big hit on ESP8266 when adding HTTPS support.
It will be added to ESP32-builds, however no ETA right now.

CSCAYA
New user
Posts: 4
Joined: 25 Mar 2024, 13:02

Re: Impossible to make https.get() request in plugin

#3 Post by CSCAYA » 25 Mar 2024, 17:52

Thanks for your reply,
I know HTTPS is not enabled on esp8266 builds, but i don't understand why the code works great without espeasy framework and it doesn't work with espeasy knowing that the same library is used in both ?

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Impossible to make https.get() request in plugin

#4 Post by TD-er » 25 Mar 2024, 20:07

WiFiClientSecureBearSSL is explicitly disabled and added to the lib_ignore if I'm not mistaken

CSCAYA
New user
Posts: 4
Joined: 25 Mar 2024, 13:02

Re: Impossible to make https.get() request in plugin

#5 Post by CSCAYA » 25 Mar 2024, 21:20

So strange, I had a look in the platformio*.INI files and the only reference to BearSSLClient is BEARSSL_SSL_BASIC. This library is not included in any lib_ignore directive.

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Impossible to make https.get() request in plugin

#6 Post by TD-er » 25 Mar 2024, 21:30

I don't know for sure as it was a long time I looked into SSL for ESP8266 and I know it was absolutely not usable with ESPEasy on ESP8266 as you simply don't have enough free RAM and those SSL libs add 20 - 50k (depending on libs, included cyphers etc) to the build size.
Lately I have spent lots and lots of hours to shave off a few kB in build size to make it all fit on ESP8266 so SSL is not going to be included in ESP8266 builds.

Also back when I was testing SSL on ESP8266 it also happened quite often you would get timeouts as the ESP8266 simply wasn't fast enough for SSL (probably running extremely low on memory isn't improving speed)

CSCAYA
New user
Posts: 4
Joined: 25 Mar 2024, 13:02

Re: Impossible to make https.get() request in plugin

#7 Post by CSCAYA » 25 Mar 2024, 22:14

Ok,

I will write a standalone script for esp32 without espeasy 😢, it should be OK.

Thanks for your answers !

Christophe

TD-er
Core team member
Posts: 8756
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Impossible to make https.get() request in plugin

#8 Post by TD-er » 25 Mar 2024, 22:41

Like I said, there will be support for HTTPS for ESP32, just not for ESP8266.

The reason it hasn't been released yet (I do have a PR pending for quite a while for ESP32) is that there is a nasty memory leak in mbed-TLS which I did make a very ugly work-around for while waiting for it to be properly fixed upstream.
And now for ESP-IDF 5.1 I have to switch to another TLS lib.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests