HTTPClient in lambda

Homeassistant as usual …

You have integrations that work nicely for many months and you update ESPHome Builder and have to invest time to fix someone’s “improvements”…

The problem I have:

time:
  - platform: sntp
    on_time:
      - seconds: 0
        minutes: /5
        then:
          - lambda: |-
              HTTPClient http;
              http.useHTTP10(true);
              ESP_LOGD("ACTPRC", "polling actual prices\r\n");
              http.begin("https://api.awattar.at/v1/marketdata");
              int httpCode = http.GET();
              if (httpCode) {
                JsonDocument doc;
                DeserializationError error = deserializeJson(doc, http.getStream());
                if (!error) {
                  float minPrc, maxPrc, avgPrc;
                  minPrc = 999.99f;

used to compile but since some months

In file included from /data/cache/platformio/packages/framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.cpp:33:
/data/cache/platformio/packages/framework-arduinoespressif32/libraries/HTTPClient/src/HTTPClient.h:36:10: fatal error: NetworkClient.h: No such file or directory

/config/esphome/doorbell.yaml: In lambda function:
/config/esphome/doorbell.yaml:143:7: error: 'HTTPClient' was not declared in this scope; did you mean 'Client'?
  143 |               HTTPClient http;
      |       ^       ~~
      |       Client
/config/esphome/doorbell.yaml:144:7: error: 'http' was not declared in this scope
  144 |               http.useHTTP10(true);
      |       ^   
*** [.pioenvs/doorbell/src/main.cpp.o] Error 1

I am tired of digging to find the reason, not even waiting for a solution actually. Dropping custom components … bad enough. having examples and modifications that

BUT the real problem i have:
Who is entitled to make such changes ? What are the benefits of just this “improvement” ? Is ANYONE checking the consequences of his smart modifications or is it a one man show ?

It seems Home Assistant needs a house sitter to work flawlessly ?

See the upgrade checklist: ESPHome 2026.2.0 - February 2026 - ESPHome - Smart Home Made Simple

https://developers.esphome.io/blog/2026/02/12/esp32-arduino-selective-compilation-libraries-disabled-by-default/

esphome:
  libraries:
    - HTTPClient

or better yet switch to HTTP Request - ESPHome - Smart Home Made Simple as it will work on all platforms ESPHome supports and you won’t have to worry so much about breaking changes, and doesn’t use the Ard APIs that Espressif has been moving away from.

2 Likes

You pressed the update button didn’t you?
That is the sad truth, you should not update ESP-Home devices unless you absolutely have to.
They do their job just fine, no need to update them and risk having breaking changes.

4 Likes
[17:05:00.686][I][HTTP:146]: 200 len:1000 {
[17:05:00.686][I][HTTP:146]:   "object": "list",
[17:05:00.686][I][HTTP:146]:   "data": [
[17:05:00.686][I][HTTP:146]:     {
[17:05:00.686][I][HTTP:146]:       "start_timestamp": 1771776000000,
[17:05:00.686][I][HTTP:146]:       "end_timestamp": 1771779600000,
[17:05:00.686][I][HTTP:146]:       "marketprice": 94.63,
[17:05:00.686][I][HTTP:146]:       "unit": "Eur/MWh"
[17:05:00.686][I][HTTP:146]:     },
[17:05:00.686][I][HTTP:146]:     {
[17:05:00.686][I][HTTP:146]:       "start_timestamp": 1771779600000,
[17:05:00.686][I][HTTP:146]:       "end_timestamp": 1771783200000,
[17:05:00.686][I][HTTP:146]:       "marketprice": 97.51,
[17:05:00.686][I][HTTP:146]:       "unit": "Eur/MWh"
[17:05:00.686][I][HTTP:146]:     },
[17:05:00.686][I][HTTP:146]:     {
[17:05:00.686][I][HTTP:146]:       "start_timestamp": 1771783200000,
[17:05:00.686][I][HTTP:146]:       "end_timestamp": 1771786800000,
[17:05:00.686][I][HTTP:146]:       "marketprice": 90.38,
[17:05:00.686][I][HTTP:146]:       "unit": "Eur/MWh"
[17:05:00.686][I][HTTP:146]:     },
[17:05:00.686][I][HTTP:146]:     {
[17:05:00.686][I][HTTP:146]:       "
[17:05:00.690][E][json:064]: Parse error: IncompleteInput

esp32:
board: esp-wrover-kit
framework:
type: esp-idf

http_request:
  verify_ssl: false
  useragent: esphome/device
  buffer_size_rx: 4096 
  timeout: 30s  # Increase from default

Excerpt of AI:
In ESPHome,

buffer_size_rx is a deprecated configuration key that is ignored in newer versions, which defaults the response buffer to 1024 bytes (approximately 1000 usable characters). This explains why your 3.5KB response is being cut off.

To fix this on an ESP32 using the esp-idf framework, you must replace buffer_size_rx with the correct modern key: max_response_buffer_size.

Corrected Configuration

Update your YAML to use this exact structure:

yaml

```
http_request:

  • verify_ssl: false*
  • useragent: esphome/device*
  • timeout: 30s*
  • Use this key instead of buffer_size_rx*

  • max_response_buffer_size: 4096 *
    ```

Getting rid of arduino is not a bad idea imo. But staying with working devices in ESPHome is difficult :slight_smile:

Probably a very uncommon task to receive 3503 Bytes …

Documentation is a nice thing to have but
max_response_buffer_size: 4096
is not accepted - maybe some more testing necessary before throwing releases ? And a default buffer size of 1000 Bytes will of course reduce memory usage - but WHO set this default to 1000 ? A Programmer ?

It was not clear to me that max_response_buffer_size is an attribute to http_request.get method rather than http_request.

Problem solved and got rid of another piece of Arduino …