Commit Graph

22667 Commits

Author SHA1 Message Date
J. Nick Koston
ba30496a7e Merge branch 'constexpr-high-impact-constants' into integration 2026-02-18 20:55:31 -06:00
J. Nick Koston
565443b710 [pulse_counter] Fix compilation on ESP32-C6/C5/H2/P4 (#14070) 2026-02-18 19:08:53 -06:00
J. Nick Koston
3b869f1720 [web_server] Double socket allocation to prevent connection exhaustion (#14067) 2026-02-18 19:01:37 -06:00
J. Nick Koston
5f82017a31 [udp] Register socket consumption for CONFIG_LWIP_MAX_SOCKETS (#14068) 2026-02-18 19:01:00 -06:00
J. Nick Koston
c28f9b148c Merge branch 'udp-consume-sockets' into integration 2026-02-18 18:45:32 -06:00
J. Nick Koston
c58ecaf909 Merge branch 'fix-pulse-counter-c6-compile' into integration 2026-02-18 18:45:24 -06:00
J. Nick Koston
9dd62b8c34 [pulse_counter] Fix compilation on ESP32-C6/C5/H2/P4
SOC_MOD_CLK_APB does not exist in the soc_module_clk_t enum on
ESP32-C6, C5, H2, and P4 variants. Revert to esp_clk_apb_freq()
which works on all variants and is the same function the ESP-IDF
PCNT driver uses internally for glitch filter calculation.
2026-02-18 18:39:35 -06:00
J. Nick Koston
2ddf46ff0a Fix ConfigType import 2026-02-18 18:31:41 -06:00
J. Nick Koston
d814b0fc77 [udp] Register socket consumption for CONFIG_LWIP_MAX_SOCKETS
The UDP component creates up to 2 sockets (broadcast + listen) but
did not register them with the socket consumption API. This could
cause CONFIG_LWIP_MAX_SOCKETS to be set too low on ESP32 IDF.

Closes https://github.com/esphome/esphome/issues/14031
2026-02-18 18:27:41 -06:00
J. Nick Koston
5226a4dd75 Merge branch 'web-server-bump-sockets' into integration 2026-02-18 18:24:18 -06:00
J. Nick Koston
0393cae770 Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts:
#	esphome/components/http_request/http_request.h
#	esphome/components/http_request/http_request_arduino.cpp
#	esphome/components/http_request/http_request_arduino.h
#	esphome/components/http_request/http_request_host.cpp
#	esphome/components/http_request/http_request_host.h
#	esphome/components/http_request/http_request_idf.cpp
#	esphome/components/http_request/http_request_idf.h
#	esphome/core/component.cpp
2026-02-18 18:23:52 -06:00
J. Nick Koston
3db34b4029 [web_server] Double socket allocation to prevent connection exhaustion
Browsers open multiple concurrent connections for page resources, SSE
event streams, and POST requests for entity control. POST connections
may linger before closing, causing httpd_accept_conn errors (ENFILE)
when the socket pool is too small.
2026-02-18 18:18:59 -06:00
J. Nick Koston
86ad7f287c Merge branch 'json_web_server_stack' into integration 2026-02-18 18:11:12 -06:00
J. Nick Koston
2dd767ed3f [json] Bump heap fallback cap from 4096 to 5120
Aligns with the doubling sequence from 640: 1280 -> 2560 -> 5120.
2026-02-18 18:10:29 -06:00
J. Nick Koston
d967f47f3e [json] Increase SerializationBuffer stack size from 512 to 640 bytes
The reduction from 768 to 512 was overly aggressive - the stack
overflow was caused by the 1400+ byte multipart parser, not the
serialization buffer. 640 bytes covers climate DETAIL_ALL payloads
(~520 bytes) on the stack without heap fallback.
2026-02-18 18:07:23 -06:00
J. Nick Koston
fee4dc6783 Merge remote-tracking branch 'origin/integration' into integration 2026-02-18 17:54:21 -06:00
J. Nick Koston
52e870a10b Merge branch 'json_web_server_stack' into integration 2026-02-18 17:54:03 -06:00
J. Nick Koston
bb6600985f [json] Make heap fallback max size constexpr 2026-02-18 17:53:29 -06:00
J. Nick Koston
1ba1ab7fe2 [json] Document heap fallback buffer sizing expectations
Payloads exceeding 1024 bytes are not known to exist in real
configurations. One doubling iteration covers all known entity types.
Cap at 4096 as a safety limit.
2026-02-18 17:53:12 -06:00
J. Nick Koston
b0669e3c81 Merge branch 'json_web_server_stack' into integration 2026-02-18 17:52:38 -06:00
J. Nick Koston
6bb8e7dae6 Merge branch 'json_web_server_stack' into integration 2026-02-18 17:52:26 -06:00
J. Nick Koston
90ed0db0d9 [json] Replace measureJson() with doubling strategy in heap fallback
Avoids instantiating DummyWriter templates (~736 bytes flash) by
doubling the heap buffer until the payload fits. The temporary
over-allocation (at most 2x) is acceptable since payloads exceeding
the 512-byte stack buffer are rare.
2026-02-18 17:51:20 -06:00
J. Nick Koston
6820e1d6b3 [json] Replace measureJson() with doubling strategy in heap fallback
Avoids instantiating DummyWriter templates (~736 bytes flash) by
doubling the heap buffer until the payload fits. The temporary
over-allocation (at most 2x) is acceptable since payloads exceeding
the 512-byte stack buffer are rare.
2026-02-18 17:51:02 -06:00
J. Nick Koston
8337743a22 Merge branch 'json_web_server_stack' into integration 2026-02-18 17:39:53 -06:00
J. Nick Koston
6a7925b3ce [json] Fix SerializationBuffer truncation when payload exceeds stack buffer
ArduinoJson's serializeJson() with a bounded buffer returns the actual
bytes written (truncated count), NOT the would-be size like snprintf().
When the payload exceeded the 512-byte stack buffer, the return value
was used as the exact size for heap reallocation, but this was only the
truncated count. The heap buffer was allocated too small, the second
serialization was also truncated, and no NUL terminator was written.

This caused corrupted JSON in SSE streams for entities with payloads
exceeding 512 bytes (e.g., climate DETAIL_ALL with many features).

Fix: use measureJson() in the heap fallback path to get the exact
untruncated size before allocating. Also add the missing set_size_()
call after the second serialization to ensure proper NUL termination.
2026-02-18 17:36:56 -06:00
J. Nick Koston
47ccb52184 Merge branch 'water-heater-web-server-traits' into integration 2026-02-18 17:06:53 -06:00
J. Nick Koston
1dc6801a19 Merge branch 'web-server-climate-preset' into integration 2026-02-18 17:06:44 -06:00
J. Nick Koston
3a53c5a689 [web_server] Fix water_heater traits in JSON state events
Move min/max temperature and step traits into DETAIL_ALL block
so they are only sent once on initial connection instead of on
every state update. Rename keys from min_temperature/max_temperature
to min_temp/max_temp to match what the frontend expects.

Discovered while reviewing #14061.
2026-02-18 16:58:08 -06:00
J. Nick Koston
bd055e75b9 [core] Shrink Application::dump_config_at_ from size_t to uint16_t (#14053)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 16:49:37 -06:00
J. Nick Koston
d90754dc0a [http_request] Replace heavy STL containers with std::vector for headers (#14024) 2026-02-18 16:49:19 -06:00
J. Nick Koston
387f615dae [api] Add handshake timeout to prevent connection slot exhaustion (#14050) 2026-02-18 16:48:30 -06:00
J. Nick Koston
02e310f2c9 [core] Remove unnecessary IRAM_ATTR from yield(), delay(), feed_wdt(), and arch_feed_wdt() (#14063) 2026-02-18 16:48:13 -06:00
Jesse Hills
d83738df87 Merge branch 'release' into dev 2026-02-19 11:43:58 +13:00
Jesse Hills
6b61edce92 Merge pull request #14062 from esphome/bump-2026.2.0
2026.2.0
2026.2.0
2026-02-19 11:36:00 +13:00
Ryan Wagoner
e27698f063 Fix clang-format for current_humidity ternary expression 2026-02-18 16:17:00 -05:00
J. Nick Koston
09fc028895 [core] Remove dead global_state variable (#14060) 2026-02-18 15:16:26 -06:00
J. Nick Koston
82cfa00a97 [tlc59208f] Make mode constants inline constexpr (#14043) 2026-02-18 15:04:30 -06:00
J. Nick Koston
4a038978d2 [pca9685] Make mode constants inline constexpr (#14042) 2026-02-18 15:04:14 -06:00
J. Nick Koston
515ceaaf3e Merge remote-tracking branch 'origin/remove-iram-attr-yield-delay' into integration 2026-02-18 15:00:36 -06:00
J. Nick Koston
5bc9faa3de [core] Remove IRAM_ATTR from feed_wdt() and arch_feed_wdt()
feed_wdt() calls status_led::global_status_led->call() which is a
vtable dispatch into flash. arch_feed_wdt() calls esp_task_wdt_reset()
which is in .flash.text. Neither function can execute with the flash
cache disabled, so IRAM_ATTR provides no benefit.
2026-02-18 14:55:32 -06:00
J. Nick Koston
791bacfe59 Merge remote-tracking branch 'origin/remove-iram-attr-yield-delay' into integration 2026-02-18 14:51:42 -06:00
J. Nick Koston
ae1fa43799 [core] Remove unnecessary IRAM_ATTR from yield() and delay()
Neither yield() nor delay() can be called from ISR context or during
flash operations. yield() calls vPortYield/::yield which are not
ISR-safe, and delay() calls vTaskDelay/::delay which block the calling
task. IRAM_ATTR was applied as a blanket attribute when the HAL
abstraction was created in 2021 (#2303) but was never actually needed
for these two functions.

Retains HOT attribute for compiler optimization hints.
2026-02-18 14:44:12 -06:00
J. Nick Koston
6373aafe28 Merge branch 'http_request_remove_list' into integration
# Conflicts:
#	esphome/components/http_request/http_request.h
#	esphome/components/http_request/http_request_arduino.cpp
#	esphome/components/http_request/http_request_arduino.h
#	esphome/components/http_request/http_request_host.cpp
#	esphome/components/http_request/http_request_host.h
#	esphome/components/http_request/http_request_idf.cpp
#	esphome/components/http_request/http_request_idf.h
2026-02-18 14:32:52 -06:00
Jesse Hills
2c89cded4b Bump version to 2026.2.0 2026-02-19 09:30:04 +13:00
J. Nick Koston
4b6ba05e55 [http_request] Replace std::list<Header> with std::vector<Header> in perform() chain
std::list uses per-node heap allocation (one allocation per element)
and has poor cache locality. std::vector is contiguous and uses a
single allocation.

Changes:
- Replace std::list<Header> with std::vector<Header> in perform()
  virtual method signature across all platforms (IDF, Arduino, Host)
- Update all start(), get(), post() overloads accordingly
- Add ESPDEPRECATED overloads for std::list<Header> callers
- Update online_image to use std::vector<Header>
- Clean up request_headers construction in play() using structured
  bindings and reserve()
2026-02-18 14:29:07 -06:00
J. Nick Koston
ba6a1d192d [http_request] Use FixedVector for request_headers_ and json_ in action
The sizes are known at Python codegen time, so use FixedVector with
init() for a single allocation and no reallocation machinery. This
eliminates _M_realloc_append template instantiations for these types.
2026-02-18 14:25:10 -06:00
J. Nick Koston
bd07e6b014 [http_request] Replace std::map with std::vector<std::pair> in action template
request_headers_ and json_ are populated at config time via
add_request_header()/add_json() and only iterated linearly at
runtime. std::map's red-black tree is unnecessary overhead for
these small collections. Drop the <map> include.
2026-02-18 14:24:59 -06:00
J. Nick Koston
8307eadda2 [http_request] Lowercase collect headers at config time, eliminate per-request overhead
Move header lowercasing from the per-request start() path to config time:
- Python codegen now lowercases collect_headers values before passing to C++
- add_collect_header() stores values as-is (already lowered by Python)
- start() with std::vector is now a direct passthrough to perform()
- Deprecated std::set overload still lowercases for external callers

Rename collect_headers_ to lower_case_collect_headers_ and update all
parameter names throughout the chain to make the lowercase invariant
explicit in the API contract.

This eliminates per-request allocation of a temporary vector and
str_lower_case() calls on every HTTP request, reducing stack usage
in the perform() call chain where stack space is critical for HTTPS
TLS handshakes.
2026-02-18 14:21:17 -06:00
Jesse Hills
bd38041d04 Merge branch 'beta' into dev 2026-02-19 09:05:23 +13:00
Jesse Hills
896dc4d34d Merge pull request #14056 from esphome/bump-2026.2.0b5
2026.2.0b5
2026.2.0b5
2026-02-19 09:04:47 +13:00