From 510c874061cd73ec95afcd26ab4f814463776d9e Mon Sep 17 00:00:00 2001 From: Keith Burzinski Date: Fri, 16 Jan 2026 19:23:41 -0600 Subject: [PATCH 01/18] [helpers] Remove `base85` functions (#13266) --- esphome/core/helpers.cpp | 49 ---------------------------------------- esphome/core/helpers.h | 8 ------- 2 files changed, 57 deletions(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 5cad2308df..5de1c70562 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -664,55 +664,6 @@ bool base64_decode_int32_vector(const std::string &base64, std::vector return !out.empty(); } -/// Encode int32 to 5 base85 characters + null terminator -/// Standard ASCII85 alphabet: '!' (33) = 0 through 'u' (117) = 84 -inline void base85_encode_int32(int32_t value, std::span output) { - uint32_t v = static_cast(value); - // Encode least significant digit first, then reverse - for (int i = 4; i >= 0; i--) { - output[i] = static_cast('!' + (v % 85)); - v /= 85; - } - output[5] = '\0'; -} - -/// Decode 5 base85 characters to int32 -inline bool base85_decode_int32(const char *input, int32_t &out) { - uint8_t c0 = static_cast(input[0] - '!'); - uint8_t c1 = static_cast(input[1] - '!'); - uint8_t c2 = static_cast(input[2] - '!'); - uint8_t c3 = static_cast(input[3] - '!'); - uint8_t c4 = static_cast(input[4] - '!'); - - // Each digit must be 0-84. Since uint8_t wraps, chars below '!' become > 84 - if (c0 > 84 || c1 > 84 || c2 > 84 || c3 > 84 || c4 > 84) - return false; - - // 85^4 = 52200625, 85^3 = 614125, 85^2 = 7225, 85^1 = 85 - out = static_cast(c0 * 52200625u + c1 * 614125u + c2 * 7225u + c3 * 85u + c4); - return true; -} - -/// Decode base85 string directly into vector (no intermediate buffer) -bool base85_decode_int32_vector(const std::string &base85, std::vector &out) { - size_t len = base85.size(); - if (len % 5 != 0) - return false; - - out.clear(); - const char *ptr = base85.data(); - const char *end = ptr + len; - - while (ptr < end) { - int32_t value; - if (!base85_decode_int32(ptr, value)) - return false; - out.push_back(value); - ptr += 5; - } - return true; -} - // Colors float gamma_correct(float value, float gamma) { diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index 000762c9bf..0acc6bdc60 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -1143,14 +1143,6 @@ size_t base64_decode(const uint8_t *encoded_data, size_t encoded_len, uint8_t *b /// @return true if successful, false if decode failed or invalid size bool base64_decode_int32_vector(const std::string &base64, std::vector &out); -/// Size of buffer needed for base85 encoded int32 (5 chars + null terminator) -static constexpr size_t BASE85_INT32_ENCODED_SIZE = 6; - -void base85_encode_int32(int32_t value, std::span output); - -bool base85_decode_int32(const char *input, int32_t &out); -bool base85_decode_int32_vector(const std::string &base85, std::vector &out); - ///@} /// @name Colors From 69d7b6e9210390051318bd8e6410727689de08d6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Jan 2026 15:46:15 -1000 Subject: [PATCH 02/18] [api] Use subtraction for protobuf bounds checking (#13306) --- esphome/components/api/proto.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/api/proto.cpp b/esphome/components/api/proto.cpp index eac26997cf..2a0ddf91db 100644 --- a/esphome/components/api/proto.cpp +++ b/esphome/components/api/proto.cpp @@ -48,14 +48,14 @@ uint32_t ProtoDecodableMessage::count_repeated_field(const uint8_t *buffer, size } uint32_t field_length = res->as_uint32(); ptr += consumed; - if (ptr + field_length > end) { + if (field_length > static_cast(end - ptr)) { return count; // Out of bounds } ptr += field_length; break; } case WIRE_TYPE_FIXED32: { // 32-bit - skip 4 bytes - if (ptr + 4 > end) { + if (end - ptr < 4) { return count; } ptr += 4; @@ -110,7 +110,7 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) { } uint32_t field_length = res->as_uint32(); ptr += consumed; - if (ptr + field_length > end) { + if (field_length > static_cast(end - ptr)) { ESP_LOGV(TAG, "Out-of-bounds Length Delimited at offset %ld", (long) (ptr - buffer)); return; } @@ -121,7 +121,7 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) { break; } case WIRE_TYPE_FIXED32: { // 32-bit - if (ptr + 4 > end) { + if (end - ptr < 4) { ESP_LOGV(TAG, "Out-of-bounds Fixed32-bit at offset %ld", (long) (ptr - buffer)); return; } From bbe11555183d544850c22a160ca93bac70e2e57d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Jan 2026 16:08:04 -1000 Subject: [PATCH 03/18] [web_server] Skip defer on ESP8266 where callbacks already run in main loop (#13261) --- esphome/components/web_server/web_server.cpp | 134 ++++++++++--------- esphome/components/web_server/web_server.h | 8 ++ 2 files changed, 81 insertions(+), 61 deletions(-) diff --git a/esphome/components/web_server/web_server.cpp b/esphome/components/web_server/web_server.cpp index cf984ea247..0e71d82233 100644 --- a/esphome/components/web_server/web_server.cpp +++ b/esphome/components/web_server/web_server.cpp @@ -658,6 +658,24 @@ std::string WebServer::text_sensor_json_(text_sensor::TextSensor *obj, const std #endif #ifdef USE_SWITCH +enum SwitchAction : uint8_t { SWITCH_ACTION_NONE, SWITCH_ACTION_TOGGLE, SWITCH_ACTION_TURN_ON, SWITCH_ACTION_TURN_OFF }; + +static void execute_switch_action(switch_::Switch *obj, SwitchAction action) { + switch (action) { + case SWITCH_ACTION_TOGGLE: + obj->toggle(); + break; + case SWITCH_ACTION_TURN_ON: + obj->turn_on(); + break; + case SWITCH_ACTION_TURN_OFF: + obj->turn_off(); + break; + default: + break; + } +} + void WebServer::on_switch_update(switch_::Switch *obj) { if (!this->include_internal_ && obj->is_internal()) return; @@ -676,34 +694,22 @@ void WebServer::handle_switch_request(AsyncWebServerRequest *request, const UrlM return; } - // Handle action methods with single defer and response - enum SwitchAction { NONE, TOGGLE, TURN_ON, TURN_OFF }; - SwitchAction action = NONE; + SwitchAction action = SWITCH_ACTION_NONE; if (match.method_equals(ESPHOME_F("toggle"))) { - action = TOGGLE; + action = SWITCH_ACTION_TOGGLE; } else if (match.method_equals(ESPHOME_F("turn_on"))) { - action = TURN_ON; + action = SWITCH_ACTION_TURN_ON; } else if (match.method_equals(ESPHOME_F("turn_off"))) { - action = TURN_OFF; + action = SWITCH_ACTION_TURN_OFF; } - if (action != NONE) { - this->defer([obj, action]() { - switch (action) { - case TOGGLE: - obj->toggle(); - break; - case TURN_ON: - obj->turn_on(); - break; - case TURN_OFF: - obj->turn_off(); - break; - default: - break; - } - }); + if (action != SWITCH_ACTION_NONE) { +#ifdef USE_ESP8266 + execute_switch_action(obj, action); +#else + this->defer([obj, action]() { execute_switch_action(obj, action); }); +#endif request->send(200); } else { request->send(404); @@ -743,7 +749,7 @@ void WebServer::handle_button_request(AsyncWebServerRequest *request, const UrlM std::string data = this->button_json_(obj, detail); request->send(200, "application/json", data.c_str()); } else if (match.method_equals(ESPHOME_F("press"))) { - this->defer([obj]() { obj->press(); }); + DEFER_ACTION(obj, obj->press()); request->send(200); return; } else { @@ -828,7 +834,7 @@ void WebServer::handle_fan_request(AsyncWebServerRequest *request, const UrlMatc std::string data = this->fan_json_(obj, detail); request->send(200, "application/json", data.c_str()); } else if (match.method_equals(ESPHOME_F("toggle"))) { - this->defer([obj]() { obj->toggle().perform(); }); + DEFER_ACTION(obj, obj->toggle().perform()); request->send(200); } else { bool is_on = match.method_equals(ESPHOME_F("turn_on")); @@ -859,7 +865,7 @@ void WebServer::handle_fan_request(AsyncWebServerRequest *request, const UrlMatc return; } } - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); } return; @@ -909,7 +915,7 @@ void WebServer::handle_light_request(AsyncWebServerRequest *request, const UrlMa std::string data = this->light_json_(obj, detail); request->send(200, "application/json", data.c_str()); } else if (match.method_equals(ESPHOME_F("toggle"))) { - this->defer([obj]() { obj->toggle().perform(); }); + DEFER_ACTION(obj, obj->toggle().perform()); request->send(200); } else { bool is_on = match.method_equals(ESPHOME_F("turn_on")); @@ -938,7 +944,7 @@ void WebServer::handle_light_request(AsyncWebServerRequest *request, const UrlMa parse_string_param_(request, ESPHOME_F("effect"), call, &decltype(call)::set_effect); } - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); } return; @@ -1027,7 +1033,7 @@ void WebServer::handle_cover_request(AsyncWebServerRequest *request, const UrlMa parse_float_param_(request, ESPHOME_F("position"), call, &decltype(call)::set_position); parse_float_param_(request, ESPHOME_F("tilt"), call, &decltype(call)::set_tilt); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1086,7 +1092,7 @@ void WebServer::handle_number_request(AsyncWebServerRequest *request, const UrlM auto call = obj->make_call(); parse_float_param_(request, ESPHOME_F("value"), call, &decltype(call)::set_value); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1159,7 +1165,7 @@ void WebServer::handle_date_request(AsyncWebServerRequest *request, const UrlMat parse_string_param_(request, ESPHOME_F("value"), call, &decltype(call)::set_date); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1223,7 +1229,7 @@ void WebServer::handle_time_request(AsyncWebServerRequest *request, const UrlMat parse_string_param_(request, ESPHOME_F("value"), call, &decltype(call)::set_time); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1286,7 +1292,7 @@ void WebServer::handle_datetime_request(AsyncWebServerRequest *request, const Ur parse_string_param_(request, ESPHOME_F("value"), call, &decltype(call)::set_datetime); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1346,7 +1352,7 @@ void WebServer::handle_text_request(AsyncWebServerRequest *request, const UrlMat auto call = obj->make_call(); parse_string_param_(request, ESPHOME_F("value"), call, &decltype(call)::set_value); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1404,7 +1410,7 @@ void WebServer::handle_select_request(AsyncWebServerRequest *request, const UrlM auto call = obj->make_call(); parse_string_param_(request, ESPHOME_F("option"), call, &decltype(call)::set_option); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1473,7 +1479,7 @@ void WebServer::handle_climate_request(AsyncWebServerRequest *request, const Url parse_float_param_(request, ESPHOME_F("target_temperature_low"), call, &decltype(call)::set_target_temperature_low); parse_float_param_(request, ESPHOME_F("target_temperature"), call, &decltype(call)::set_target_temperature); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1589,6 +1595,24 @@ std::string WebServer::climate_json_(climate::Climate *obj, JsonDetail start_con #endif #ifdef USE_LOCK +enum LockAction : uint8_t { LOCK_ACTION_NONE, LOCK_ACTION_LOCK, LOCK_ACTION_UNLOCK, LOCK_ACTION_OPEN }; + +static void execute_lock_action(lock::Lock *obj, LockAction action) { + switch (action) { + case LOCK_ACTION_LOCK: + obj->lock(); + break; + case LOCK_ACTION_UNLOCK: + obj->unlock(); + break; + case LOCK_ACTION_OPEN: + obj->open(); + break; + default: + break; + } +} + void WebServer::on_lock_update(lock::Lock *obj) { if (!this->include_internal_ && obj->is_internal()) return; @@ -1607,34 +1631,22 @@ void WebServer::handle_lock_request(AsyncWebServerRequest *request, const UrlMat return; } - // Handle action methods with single defer and response - enum LockAction { NONE, LOCK, UNLOCK, OPEN }; - LockAction action = NONE; + LockAction action = LOCK_ACTION_NONE; if (match.method_equals(ESPHOME_F("lock"))) { - action = LOCK; + action = LOCK_ACTION_LOCK; } else if (match.method_equals(ESPHOME_F("unlock"))) { - action = UNLOCK; + action = LOCK_ACTION_UNLOCK; } else if (match.method_equals(ESPHOME_F("open"))) { - action = OPEN; + action = LOCK_ACTION_OPEN; } - if (action != NONE) { - this->defer([obj, action]() { - switch (action) { - case LOCK: - obj->lock(); - break; - case UNLOCK: - obj->unlock(); - break; - case OPEN: - obj->open(); - break; - default: - break; - } - }); + if (action != LOCK_ACTION_NONE) { +#ifdef USE_ESP8266 + execute_lock_action(obj, action); +#else + this->defer([obj, action]() { execute_lock_action(obj, action); }); +#endif request->send(200); } else { request->send(404); @@ -1717,7 +1729,7 @@ void WebServer::handle_valve_request(AsyncWebServerRequest *request, const UrlMa parse_float_param_(request, ESPHOME_F("position"), call, &decltype(call)::set_position); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1796,7 +1808,7 @@ void WebServer::handle_alarm_control_panel_request(AsyncWebServerRequest *reques return; } - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -1872,7 +1884,7 @@ void WebServer::handle_water_heater_request(AsyncWebServerRequest *request, cons // Parse on/off parameter parse_bool_param_(request, ESPHOME_F("is_on"), base_call, &water_heater::WaterHeaterCall::set_on); - this->defer([call]() mutable { call.perform(); }); + DEFER_ACTION(call, call.perform()); request->send(200); return; } @@ -2032,7 +2044,7 @@ void WebServer::handle_update_request(AsyncWebServerRequest *request, const UrlM return; } - this->defer([obj]() mutable { obj->perform(); }); + DEFER_ACTION(obj, obj->perform()); request->send(200); return; } diff --git a/esphome/components/web_server/web_server.h b/esphome/components/web_server/web_server.h index b1a495ebef..c434d664cf 100644 --- a/esphome/components/web_server/web_server.h +++ b/esphome/components/web_server/web_server.h @@ -42,6 +42,14 @@ using ParamNameType = const __FlashStringHelper *; using ParamNameType = const char *; #endif +// ESP8266 is single-threaded, so actions can execute directly in request context. +// Multi-core platforms need to defer to main loop thread for thread safety. +#ifdef USE_ESP8266 +#define DEFER_ACTION(capture, action) action +#else +#define DEFER_ACTION(capture, action) this->defer([capture]() mutable { action; }) +#endif + /// Result of matching a URL against an entity struct EntityMatchResult { bool matched; ///< True if entity matched the URL From e54d5ee8980dbf138813ae678289280c0f95fdad Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Jan 2026 17:16:38 -1000 Subject: [PATCH 04/18] [hmac_sha256] Replace unsafe sprintf with format_hex_to (#13290) --- esphome/components/hmac_sha256/hmac_sha256.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/esphome/components/hmac_sha256/hmac_sha256.cpp b/esphome/components/hmac_sha256/hmac_sha256.cpp index cf5daf63af..2146e961bc 100644 --- a/esphome/components/hmac_sha256/hmac_sha256.cpp +++ b/esphome/components/hmac_sha256/hmac_sha256.cpp @@ -1,4 +1,3 @@ -#include #include #include "hmac_sha256.h" #if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) || defined(USE_HOST) @@ -26,9 +25,7 @@ void HmacSHA256::calculate() { mbedtls_md_hmac_finish(&this->ctx_, this->digest_ void HmacSHA256::get_bytes(uint8_t *output) { memcpy(output, this->digest_, SHA256_DIGEST_SIZE); } void HmacSHA256::get_hex(char *output) { - for (size_t i = 0; i < SHA256_DIGEST_SIZE; i++) { - sprintf(output + (i * 2), "%02x", this->digest_[i]); - } + format_hex_to(output, SHA256_DIGEST_SIZE * 2 + 1, this->digest_, SHA256_DIGEST_SIZE); } bool HmacSHA256::equals_bytes(const uint8_t *expected) { From 92808a09c7548a6284e53ae94ffcf61e717ff89c Mon Sep 17 00:00:00 2001 From: Stuart Parmenter Date: Fri, 16 Jan 2026 19:17:36 -0800 Subject: [PATCH 05/18] [hub75] Bump esp-hub75 version to 0.3.0 (#13243) --- esphome/components/hub75/display.py | 58 ++++++++++++++++++++++++----- esphome/idf_component.yml | 4 +- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/esphome/components/hub75/display.py b/esphome/components/hub75/display.py index 20c731e730..0eeb4bba33 100644 --- a/esphome/components/hub75/display.py +++ b/esphome/components/hub75/display.py @@ -1,3 +1,4 @@ +import logging from typing import Any from esphome import automation, pins @@ -18,13 +19,16 @@ from esphome.const import ( CONF_ROTATION, CONF_UPDATE_INTERVAL, ) -from esphome.core import ID +from esphome.core import ID, EnumValue from esphome.cpp_generator import MockObj, TemplateArgsType import esphome.final_validate as fv +from esphome.helpers import add_class_to_obj from esphome.types import ConfigType from . import boards, hub75_ns +_LOGGER = logging.getLogger(__name__) + DEPENDENCIES = ["esp32"] CODEOWNERS = ["@stuartparmenter"] @@ -120,13 +124,51 @@ PANEL_LAYOUTS = { } Hub75ScanWiring = cg.global_ns.enum("Hub75ScanWiring", is_class=True) -SCAN_PATTERNS = { +SCAN_WIRINGS = { "STANDARD_TWO_SCAN": Hub75ScanWiring.STANDARD_TWO_SCAN, - "FOUR_SCAN_16PX_HIGH": Hub75ScanWiring.FOUR_SCAN_16PX_HIGH, - "FOUR_SCAN_32PX_HIGH": Hub75ScanWiring.FOUR_SCAN_32PX_HIGH, - "FOUR_SCAN_64PX_HIGH": Hub75ScanWiring.FOUR_SCAN_64PX_HIGH, + "SCAN_1_4_16PX_HIGH": Hub75ScanWiring.SCAN_1_4_16PX_HIGH, + "SCAN_1_8_32PX_HIGH": Hub75ScanWiring.SCAN_1_8_32PX_HIGH, + "SCAN_1_8_40PX_HIGH": Hub75ScanWiring.SCAN_1_8_40PX_HIGH, + "SCAN_1_8_64PX_HIGH": Hub75ScanWiring.SCAN_1_8_64PX_HIGH, } +# Deprecated scan wiring names - mapped to new names +DEPRECATED_SCAN_WIRINGS = { + "FOUR_SCAN_16PX_HIGH": "SCAN_1_4_16PX_HIGH", + "FOUR_SCAN_32PX_HIGH": "SCAN_1_8_32PX_HIGH", + "FOUR_SCAN_64PX_HIGH": "SCAN_1_8_64PX_HIGH", +} + + +def _validate_scan_wiring(value): + """Validate scan_wiring with deprecation warnings for old names.""" + value = cv.string(value).upper().replace(" ", "_") + + # Check if using deprecated name + # Remove deprecated names in 2026.7.0 + if value in DEPRECATED_SCAN_WIRINGS: + new_name = DEPRECATED_SCAN_WIRINGS[value] + _LOGGER.warning( + "Scan wiring '%s' is deprecated and will be removed in ESPHome 2026.7.0. " + "Please use '%s' instead.", + value, + new_name, + ) + value = new_name + + # Validate against allowed values + if value not in SCAN_WIRINGS: + raise cv.Invalid( + f"Unknown scan wiring '{value}'. " + f"Valid options are: {', '.join(sorted(SCAN_WIRINGS.keys()))}" + ) + + # Return as EnumValue like cv.enum does + result = add_class_to_obj(value, EnumValue) + result.enum_value = SCAN_WIRINGS[value] + return result + + Hub75ClockSpeed = cg.global_ns.enum("Hub75ClockSpeed", is_class=True) CLOCK_SPEEDS = { "8MHZ": Hub75ClockSpeed.HZ_8M, @@ -382,9 +424,7 @@ CONFIG_SCHEMA = cv.All( cv.Optional(CONF_LAYOUT_COLS): cv.positive_int, cv.Optional(CONF_LAYOUT): cv.enum(PANEL_LAYOUTS, upper=True, space="_"), # Panel hardware configuration - cv.Optional(CONF_SCAN_WIRING): cv.enum( - SCAN_PATTERNS, upper=True, space="_" - ), + cv.Optional(CONF_SCAN_WIRING): _validate_scan_wiring, cv.Optional(CONF_SHIFT_DRIVER): cv.enum(SHIFT_DRIVERS, upper=True), # Display configuration cv.Optional(CONF_DOUBLE_BUFFER): cv.boolean, @@ -547,7 +587,7 @@ def _build_config_struct( async def to_code(config: ConfigType) -> None: add_idf_component( name="esphome/esp-hub75", - ref="0.2.2", + ref="0.3.0", ) # Set compile-time configuration via build flags (so external library sees them) diff --git a/esphome/idf_component.yml b/esphome/idf_component.yml index 045b3f9168..5903e68e8e 100644 --- a/esphome/idf_component.yml +++ b/esphome/idf_component.yml @@ -28,8 +28,8 @@ dependencies: rules: - if: "target in [esp32s2, esp32s3, esp32p4]" esphome/esp-hub75: - version: 0.2.2 + version: 0.3.0 rules: - - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" + - if: "target in [esp32, esp32s2, esp32s3, esp32c6, esp32p4]" esp32async/asynctcp: version: 3.4.91 From 1f4221abfa5b6298dba5fa8ee9ca4f770cad9023 Mon Sep 17 00:00:00 2001 From: Mike Ford <60777900+HLFCode@users.noreply.github.com> Date: Sat, 17 Jan 2026 03:18:48 +0000 Subject: [PATCH 06/18] [http_request] Unable to handle chunked responses (#7884) Co-authored-by: J. Nick Koston --- esphome/components/http_request/http_request.h | 4 +--- .../components/http_request/http_request_idf.cpp | 16 +++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/esphome/components/http_request/http_request.h b/esphome/components/http_request/http_request.h index 1b5fd9f00e..a8c2cdfc63 100644 --- a/esphome/components/http_request/http_request.h +++ b/esphome/components/http_request/http_request.h @@ -242,9 +242,7 @@ template class HttpRequestSendAction : public Action { return; } - size_t content_length = container->content_length; - size_t max_length = std::min(content_length, this->max_response_buffer_size_); - + size_t max_length = this->max_response_buffer_size_; #ifdef USE_HTTP_REQUEST_RESPONSE if (this->capture_response_.value(x...)) { std::string response_body; diff --git a/esphome/components/http_request/http_request_idf.cpp b/esphome/components/http_request/http_request_idf.cpp index 725a9c1c1e..1de947ba5b 100644 --- a/esphome/components/http_request/http_request_idf.cpp +++ b/esphome/components/http_request/http_request_idf.cpp @@ -213,18 +213,12 @@ int HttpContainerIDF::read(uint8_t *buf, size_t max_len) { const uint32_t start = millis(); watchdog::WatchdogManager wdm(this->parent_->get_watchdog_timeout()); - int bufsize = std::min(max_len, this->content_length - this->bytes_read_); - - if (bufsize == 0) { - this->duration_ms += (millis() - start); - return 0; + this->feed_wdt(); + int read_len = esp_http_client_read(this->client_, (char *) buf, max_len); + this->feed_wdt(); + if (read_len > 0) { + this->bytes_read_ += read_len; } - - this->feed_wdt(); - int read_len = esp_http_client_read(this->client_, (char *) buf, bufsize); - this->feed_wdt(); - this->bytes_read_ += read_len; - this->duration_ms += (millis() - start); return read_len; From 9caf78aa7e9fcad5767ae841d416495d9a6ecd8e Mon Sep 17 00:00:00 2001 From: Kevin Ahrendt Date: Tue, 13 Jan 2026 19:42:36 +0000 Subject: [PATCH 07/18] [i2s_audio] Bugfix: Buffer overflow in software volume control (#13190) --- esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp index 53e378c41e..c934d12d65 100644 --- a/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp +++ b/esphome/components/i2s_audio/speaker/i2s_audio_speaker.cpp @@ -340,8 +340,8 @@ void I2SAudioSpeaker::speaker_task(void *params) { const uint32_t read_delay = (this_speaker->current_stream_info_.frames_to_microseconds(frames_written) / 1000) / 2; - uint8_t *new_data = transfer_buffer->get_buffer_end(); // track start of any newly copied bytes size_t bytes_read = transfer_buffer->transfer_data_from_source(pdMS_TO_TICKS(read_delay)); + uint8_t *new_data = transfer_buffer->get_buffer_end() - bytes_read; if (bytes_read > 0) { if (this_speaker->q15_volume_factor_ < INT16_MAX) { From 6f29dbd6f123ea9fa95f702b0ff6b4f8a4015477 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Jan 2026 15:46:15 -1000 Subject: [PATCH 08/18] [api] Use subtraction for protobuf bounds checking (#13306) --- esphome/components/api/proto.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/api/proto.cpp b/esphome/components/api/proto.cpp index 4f0d0846d7..b496ad5110 100644 --- a/esphome/components/api/proto.cpp +++ b/esphome/components/api/proto.cpp @@ -48,14 +48,14 @@ uint32_t ProtoDecodableMessage::count_repeated_field(const uint8_t *buffer, size } uint32_t field_length = res->as_uint32(); ptr += consumed; - if (ptr + field_length > end) { + if (field_length > static_cast(end - ptr)) { return count; // Out of bounds } ptr += field_length; break; } case WIRE_TYPE_FIXED32: { // 32-bit - skip 4 bytes - if (ptr + 4 > end) { + if (end - ptr < 4) { return count; } ptr += 4; @@ -110,7 +110,7 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) { } uint32_t field_length = res->as_uint32(); ptr += consumed; - if (ptr + field_length > end) { + if (field_length > static_cast(end - ptr)) { ESP_LOGV(TAG, "Out-of-bounds Length Delimited at offset %ld", (long) (ptr - buffer)); return; } @@ -121,7 +121,7 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) { break; } case WIRE_TYPE_FIXED32: { // 32-bit - if (ptr + 4 > end) { + if (end - ptr < 4) { ESP_LOGV(TAG, "Out-of-bounds Fixed32-bit at offset %ld", (long) (ptr - buffer)); return; } From ec7f72e2802a3b3a20f83b90c94b791a441524fa Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Fri, 16 Jan 2026 22:24:05 -0500 Subject: [PATCH 09/18] Bump version to 2025.12.7 --- Doxyfile | 2 +- esphome/const.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doxyfile b/Doxyfile index a23e21dd0d..7638fa4317 100644 --- a/Doxyfile +++ b/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = ESPHome # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 2025.12.6 +PROJECT_NUMBER = 2025.12.7 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/esphome/const.py b/esphome/const.py index 6771b9f265..e8f9c932cd 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -4,7 +4,7 @@ from enum import Enum from esphome.enum import StrEnum -__version__ = "2025.12.6" +__version__ = "2025.12.7" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" VALID_SUBSTITUTIONS_CHARACTERS = ( From f88e8fc43b6deb87c1f9f516cc14961f5510d097 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 Jan 2026 11:32:02 -1000 Subject: [PATCH 10/18] [sprinkler] Fix scheduler deprecation warnings and heap churn with FixedVector (#13251) --- esphome/components/sprinkler/sprinkler.cpp | 6 ++++-- esphome/components/sprinkler/sprinkler.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/esphome/components/sprinkler/sprinkler.cpp b/esphome/components/sprinkler/sprinkler.cpp index ca9f85abd8..2813b4450b 100644 --- a/esphome/components/sprinkler/sprinkler.cpp +++ b/esphome/components/sprinkler/sprinkler.cpp @@ -332,6 +332,7 @@ Sprinkler::Sprinkler(const std::string &name) { // The `name` is needed to set timers up, hence non-default constructor // replaces `set_name()` method previously existed this->name_ = name; + this->timer_.init(2); this->timer_.push_back({this->name_ + "sm", false, 0, 0, std::bind(&Sprinkler::sm_timer_callback_, this)}); this->timer_.push_back({this->name_ + "vs", false, 0, 0, std::bind(&Sprinkler::valve_selection_callback_, this)}); } @@ -1574,7 +1575,8 @@ const LogString *Sprinkler::state_as_str_(SprinklerState state) { void Sprinkler::start_timer_(const SprinklerTimerIndex timer_index) { if (this->timer_duration_(timer_index) > 0) { - this->set_timeout(this->timer_[timer_index].name, this->timer_duration_(timer_index), + // FixedVector ensures timer_ can't be resized, so .c_str() pointers remain valid + this->set_timeout(this->timer_[timer_index].name.c_str(), this->timer_duration_(timer_index), this->timer_cbf_(timer_index)); this->timer_[timer_index].start_time = millis(); this->timer_[timer_index].active = true; @@ -1585,7 +1587,7 @@ void Sprinkler::start_timer_(const SprinklerTimerIndex timer_index) { bool Sprinkler::cancel_timer_(const SprinklerTimerIndex timer_index) { this->timer_[timer_index].active = false; - return this->cancel_timeout(this->timer_[timer_index].name); + return this->cancel_timeout(this->timer_[timer_index].name.c_str()); } bool Sprinkler::timer_active_(const SprinklerTimerIndex timer_index) { return this->timer_[timer_index].active; } diff --git a/esphome/components/sprinkler/sprinkler.h b/esphome/components/sprinkler/sprinkler.h index 25e2d42446..273c0e9208 100644 --- a/esphome/components/sprinkler/sprinkler.h +++ b/esphome/components/sprinkler/sprinkler.h @@ -3,6 +3,7 @@ #include "esphome/core/automation.h" #include "esphome/core/component.h" #include "esphome/core/hal.h" +#include "esphome/core/helpers.h" #include "esphome/components/number/number.h" #include "esphome/components/switch/switch.h" @@ -553,8 +554,8 @@ class Sprinkler : public Component { /// Sprinkler valve operator objects std::vector valve_op_{2}; - /// Valve control timers - std::vector timer_{}; + /// Valve control timers - FixedVector enforces that this can never grow beyond init() size + FixedVector timer_; /// Other Sprinkler instances we should be aware of (used to check if pumps are in use) std::vector other_controllers_; From 973fc4c5dc14b5d42326dd007c7e04e89aa8042a Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 Jan 2026 16:48:44 -1000 Subject: [PATCH 11/18] [dallas_temp] Use const char* for set_timeout to fix deprecation warning and heap churn (#13250) --- esphome/components/dallas_temp/dallas_temp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/dallas_temp/dallas_temp.cpp b/esphome/components/dallas_temp/dallas_temp.cpp index a1b684abbf..13f2fa59bd 100644 --- a/esphome/components/dallas_temp/dallas_temp.cpp +++ b/esphome/components/dallas_temp/dallas_temp.cpp @@ -44,7 +44,7 @@ void DallasTemperatureSensor::update() { this->send_command_(DALLAS_COMMAND_START_CONVERSION); - this->set_timeout(this->get_address_name(), this->millis_to_wait_for_conversion_(), [this] { + this->set_timeout(this->get_address_name().c_str(), this->millis_to_wait_for_conversion_(), [this] { if (!this->read_scratch_pad_() || !this->check_scratch_pad_()) { this->publish_state(NAN); return; From edb303e495b073a33433c5212ed417a120b24a11 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 Jan 2026 16:49:01 -1000 Subject: [PATCH 12/18] [api] Fix clock conflicts when multiple clients connected to homeassistant time (#13253) --- esphome/components/api/api_server.cpp | 4 +++- esphome/components/time/real_time_clock.cpp | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/esphome/components/api/api_server.cpp b/esphome/components/api/api_server.cpp index a63d33f73b..ed97c3b9a2 100644 --- a/esphome/components/api/api_server.cpp +++ b/esphome/components/api/api_server.cpp @@ -558,8 +558,10 @@ bool APIServer::clear_noise_psk(bool make_active) { #ifdef USE_HOMEASSISTANT_TIME void APIServer::request_time() { for (auto &client : this->clients_) { - if (!client->flags_.remove && client->is_authenticated()) + if (!client->flags_.remove && client->is_authenticated()) { client->send_time_request(); + return; // Only request from one client to avoid clock conflicts + } } } #endif diff --git a/esphome/components/time/real_time_clock.cpp b/esphome/components/time/real_time_clock.cpp index 639af4457f..f217d14c55 100644 --- a/esphome/components/time/real_time_clock.cpp +++ b/esphome/components/time/real_time_clock.cpp @@ -31,6 +31,18 @@ void RealTimeClock::dump_config() { void RealTimeClock::synchronize_epoch_(uint32_t epoch) { ESP_LOGVV(TAG, "Got epoch %" PRIu32, epoch); + // Skip if time is already synchronized to avoid unnecessary writes, log spam, + // and prevent clock jumping backwards due to network latency + constexpr time_t min_valid_epoch = 1546300800; // January 1, 2019 + time_t current_time = this->timestamp_now(); + // Check if time is valid (year >= 2019) before comparing + if (current_time >= min_valid_epoch) { + // Unsigned subtraction handles wraparound correctly, then cast to signed + int32_t diff = static_cast(epoch - static_cast(current_time)); + if (diff >= -1 && diff <= 1) { + return; + } + } // Update UTC epoch time. #ifdef USE_ZEPHYR struct timespec ts; From 50aa4b1992d627659126d76a63c65763abbfddfe Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 15 Jan 2026 16:49:19 -1000 Subject: [PATCH 13/18] [esp32_ble_client] Reduce GATT data event logging to prevent firmware update failures (#13252) --- .../esp32_ble_client/ble_client_base.cpp | 38 +++++++++++-------- .../esp32_ble_client/ble_client_base.h | 3 +- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/esphome/components/esp32_ble_client/ble_client_base.cpp b/esphome/components/esp32_ble_client/ble_client_base.cpp index 149fcc79d5..01f79156a9 100644 --- a/esphome/components/esp32_ble_client/ble_client_base.cpp +++ b/esphome/components/esp32_ble_client/ble_client_base.cpp @@ -193,10 +193,18 @@ void BLEClientBase::log_event_(const char *name) { ESP_LOGD(TAG, "[%d] [%s] %s", this->connection_index_, this->address_str_, name); } -void BLEClientBase::log_gattc_event_(const char *name) { +void BLEClientBase::log_gattc_lifecycle_event_(const char *name) { ESP_LOGD(TAG, "[%d] [%s] ESP_GATTC_%s_EVT", this->connection_index_, this->address_str_, name); } +void BLEClientBase::log_gattc_data_event_(const char *name) { + // Data transfer events are logged at VERBOSE level because logging to UART creates + // delays that cause timing issues during time-sensitive BLE operations. This is + // especially problematic during pairing or firmware updates which require rapid + // writes to many characteristics - the log spam can cause these operations to fail. + ESP_LOGV(TAG, "[%d] [%s] ESP_GATTC_%s_EVT", this->connection_index_, this->address_str_, name); +} + void BLEClientBase::log_gattc_warning_(const char *operation, esp_gatt_status_t status) { ESP_LOGW(TAG, "[%d] [%s] %s error, status=%d", this->connection_index_, this->address_str_, operation, status); } @@ -280,7 +288,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ case ESP_GATTC_OPEN_EVT: { if (!this->check_addr(param->open.remote_bda)) return false; - this->log_gattc_event_("OPEN"); + this->log_gattc_lifecycle_event_("OPEN"); // conn_id was already set in ESP_GATTC_CONNECT_EVT this->service_count_ = 0; @@ -331,7 +339,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ case ESP_GATTC_CONNECT_EVT: { if (!this->check_addr(param->connect.remote_bda)) return false; - this->log_gattc_event_("CONNECT"); + this->log_gattc_lifecycle_event_("CONNECT"); this->conn_id_ = param->connect.conn_id; // Start MTU negotiation immediately as recommended by ESP-IDF examples // (gatt_client, ble_throughput) which call esp_ble_gattc_send_mtu_req in @@ -376,7 +384,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ case ESP_GATTC_CLOSE_EVT: { if (this->conn_id_ != param->close.conn_id) return false; - this->log_gattc_event_("CLOSE"); + this->log_gattc_lifecycle_event_("CLOSE"); this->release_services(); this->set_state(espbt::ClientState::IDLE); this->conn_id_ = UNSET_CONN_ID; @@ -404,7 +412,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ case ESP_GATTC_SEARCH_CMPL_EVT: { if (this->conn_id_ != param->search_cmpl.conn_id) return false; - this->log_gattc_event_("SEARCH_CMPL"); + this->log_gattc_lifecycle_event_("SEARCH_CMPL"); // For V3_WITHOUT_CACHE, switch back to medium connection parameters after service discovery // This balances performance with bandwidth usage after the critical discovery phase if (this->connection_type_ == espbt::ConnectionType::V3_WITHOUT_CACHE) { @@ -431,35 +439,35 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ case ESP_GATTC_READ_DESCR_EVT: { if (this->conn_id_ != param->write.conn_id) return false; - this->log_gattc_event_("READ_DESCR"); + this->log_gattc_data_event_("READ_DESCR"); break; } case ESP_GATTC_WRITE_DESCR_EVT: { if (this->conn_id_ != param->write.conn_id) return false; - this->log_gattc_event_("WRITE_DESCR"); + this->log_gattc_data_event_("WRITE_DESCR"); break; } case ESP_GATTC_WRITE_CHAR_EVT: { if (this->conn_id_ != param->write.conn_id) return false; - this->log_gattc_event_("WRITE_CHAR"); + this->log_gattc_data_event_("WRITE_CHAR"); break; } case ESP_GATTC_READ_CHAR_EVT: { if (this->conn_id_ != param->read.conn_id) return false; - this->log_gattc_event_("READ_CHAR"); + this->log_gattc_data_event_("READ_CHAR"); break; } case ESP_GATTC_NOTIFY_EVT: { if (this->conn_id_ != param->notify.conn_id) return false; - this->log_gattc_event_("NOTIFY"); + this->log_gattc_data_event_("NOTIFY"); break; } case ESP_GATTC_REG_FOR_NOTIFY_EVT: { - this->log_gattc_event_("REG_FOR_NOTIFY"); + this->log_gattc_data_event_("REG_FOR_NOTIFY"); if (this->connection_type_ == espbt::ConnectionType::V3_WITH_CACHE || this->connection_type_ == espbt::ConnectionType::V3_WITHOUT_CACHE) { // Client is responsible for flipping the descriptor value @@ -491,7 +499,7 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ esp_err_t status = esp_ble_gattc_write_char_descr(this->gattc_if_, this->conn_id_, desc_result.handle, sizeof(notify_en), (uint8_t *) ¬ify_en, ESP_GATT_WRITE_TYPE_RSP, ESP_GATT_AUTH_REQ_NONE); - ESP_LOGD(TAG, "Wrote notify descriptor %d, properties=%d", notify_en, char_result.properties); + ESP_LOGV(TAG, "Wrote notify descriptor %d, properties=%d", notify_en, char_result.properties); if (status) { this->log_gattc_warning_("esp_ble_gattc_write_char_descr", status); } @@ -499,13 +507,13 @@ bool BLEClientBase::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_ } case ESP_GATTC_UNREG_FOR_NOTIFY_EVT: { - this->log_gattc_event_("UNREG_FOR_NOTIFY"); + this->log_gattc_data_event_("UNREG_FOR_NOTIFY"); break; } default: - // ideally would check all other events for matching conn_id - ESP_LOGD(TAG, "[%d] [%s] Event %d", this->connection_index_, this->address_str_, event); + // Unknown events logged at VERBOSE to avoid UART delays during time-sensitive operations + ESP_LOGV(TAG, "[%d] [%s] Event %d", this->connection_index_, this->address_str_, event); break; } return true; diff --git a/esphome/components/esp32_ble_client/ble_client_base.h b/esphome/components/esp32_ble_client/ble_client_base.h index 92c7444ee1..c52f0e5d2d 100644 --- a/esphome/components/esp32_ble_client/ble_client_base.h +++ b/esphome/components/esp32_ble_client/ble_client_base.h @@ -127,7 +127,8 @@ class BLEClientBase : public espbt::ESPBTClient, public Component { // 6 bytes used, 2 bytes padding void log_event_(const char *name); - void log_gattc_event_(const char *name); + void log_gattc_lifecycle_event_(const char *name); + void log_gattc_data_event_(const char *name); void update_conn_params_(uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t timeout, const char *param_type); void set_conn_params_(uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t timeout, From e1800d2fe25561979a64be1d3dcbc471f17eefa6 Mon Sep 17 00:00:00 2001 From: mrtoy-me <118446898+mrtoy-me@users.noreply.github.com> Date: Sat, 17 Jan 2026 01:19:09 +1000 Subject: [PATCH 14/18] [ntc, resistance] change log level to verbose (#13268) --- esphome/components/ntc/ntc.cpp | 2 +- esphome/components/resistance/resistance_sensor.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/components/ntc/ntc.cpp b/esphome/components/ntc/ntc.cpp index b08f84029b..cc500ba429 100644 --- a/esphome/components/ntc/ntc.cpp +++ b/esphome/components/ntc/ntc.cpp @@ -23,7 +23,7 @@ void NTC::process_(float value) { double v = this->a_ + this->b_ * lr + this->c_ * lr * lr * lr; auto temp = float(1.0 / v - 273.15); - ESP_LOGD(TAG, "'%s' - Temperature: %.1f°C", this->name_.c_str(), temp); + ESP_LOGV(TAG, "'%s' - Temperature: %.1f°C", this->name_.c_str(), temp); this->publish_state(temp); } diff --git a/esphome/components/resistance/resistance_sensor.cpp b/esphome/components/resistance/resistance_sensor.cpp index 6e57214449..706a059de3 100644 --- a/esphome/components/resistance/resistance_sensor.cpp +++ b/esphome/components/resistance/resistance_sensor.cpp @@ -39,7 +39,7 @@ void ResistanceSensor::process_(float value) { } res *= this->resistor_; - ESP_LOGD(TAG, "'%s' - Resistance %.1fΩ", this->name_.c_str(), res); + ESP_LOGV(TAG, "'%s' - Resistance %.1fΩ", this->name_.c_str(), res); this->publish_state(res); } From d8463f48136aa94c870184a77ce71a8848b9ac50 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 16 Jan 2026 17:16:38 -1000 Subject: [PATCH 15/18] [hmac_sha256] Replace unsafe sprintf with format_hex_to (#13290) --- esphome/components/hmac_sha256/hmac_sha256.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/esphome/components/hmac_sha256/hmac_sha256.cpp b/esphome/components/hmac_sha256/hmac_sha256.cpp index cf5daf63af..2146e961bc 100644 --- a/esphome/components/hmac_sha256/hmac_sha256.cpp +++ b/esphome/components/hmac_sha256/hmac_sha256.cpp @@ -1,4 +1,3 @@ -#include #include #include "hmac_sha256.h" #if defined(USE_ESP32) || defined(USE_ESP8266) || defined(USE_RP2040) || defined(USE_LIBRETINY) || defined(USE_HOST) @@ -26,9 +25,7 @@ void HmacSHA256::calculate() { mbedtls_md_hmac_finish(&this->ctx_, this->digest_ void HmacSHA256::get_bytes(uint8_t *output) { memcpy(output, this->digest_, SHA256_DIGEST_SIZE); } void HmacSHA256::get_hex(char *output) { - for (size_t i = 0; i < SHA256_DIGEST_SIZE; i++) { - sprintf(output + (i * 2), "%02x", this->digest_[i]); - } + format_hex_to(output, SHA256_DIGEST_SIZE * 2 + 1, this->digest_, SHA256_DIGEST_SIZE); } bool HmacSHA256::equals_bytes(const uint8_t *expected) { From 60e333db088c0de3c2a2f8fe26f50f08ce0aca60 Mon Sep 17 00:00:00 2001 From: Stuart Parmenter Date: Fri, 16 Jan 2026 19:17:36 -0800 Subject: [PATCH 16/18] [hub75] Bump esp-hub75 version to 0.3.0 (#13243) --- esphome/components/hub75/display.py | 58 ++++++++++++++++++++++++----- esphome/idf_component.yml | 4 +- 2 files changed, 51 insertions(+), 11 deletions(-) diff --git a/esphome/components/hub75/display.py b/esphome/components/hub75/display.py index 20c731e730..0eeb4bba33 100644 --- a/esphome/components/hub75/display.py +++ b/esphome/components/hub75/display.py @@ -1,3 +1,4 @@ +import logging from typing import Any from esphome import automation, pins @@ -18,13 +19,16 @@ from esphome.const import ( CONF_ROTATION, CONF_UPDATE_INTERVAL, ) -from esphome.core import ID +from esphome.core import ID, EnumValue from esphome.cpp_generator import MockObj, TemplateArgsType import esphome.final_validate as fv +from esphome.helpers import add_class_to_obj from esphome.types import ConfigType from . import boards, hub75_ns +_LOGGER = logging.getLogger(__name__) + DEPENDENCIES = ["esp32"] CODEOWNERS = ["@stuartparmenter"] @@ -120,13 +124,51 @@ PANEL_LAYOUTS = { } Hub75ScanWiring = cg.global_ns.enum("Hub75ScanWiring", is_class=True) -SCAN_PATTERNS = { +SCAN_WIRINGS = { "STANDARD_TWO_SCAN": Hub75ScanWiring.STANDARD_TWO_SCAN, - "FOUR_SCAN_16PX_HIGH": Hub75ScanWiring.FOUR_SCAN_16PX_HIGH, - "FOUR_SCAN_32PX_HIGH": Hub75ScanWiring.FOUR_SCAN_32PX_HIGH, - "FOUR_SCAN_64PX_HIGH": Hub75ScanWiring.FOUR_SCAN_64PX_HIGH, + "SCAN_1_4_16PX_HIGH": Hub75ScanWiring.SCAN_1_4_16PX_HIGH, + "SCAN_1_8_32PX_HIGH": Hub75ScanWiring.SCAN_1_8_32PX_HIGH, + "SCAN_1_8_40PX_HIGH": Hub75ScanWiring.SCAN_1_8_40PX_HIGH, + "SCAN_1_8_64PX_HIGH": Hub75ScanWiring.SCAN_1_8_64PX_HIGH, } +# Deprecated scan wiring names - mapped to new names +DEPRECATED_SCAN_WIRINGS = { + "FOUR_SCAN_16PX_HIGH": "SCAN_1_4_16PX_HIGH", + "FOUR_SCAN_32PX_HIGH": "SCAN_1_8_32PX_HIGH", + "FOUR_SCAN_64PX_HIGH": "SCAN_1_8_64PX_HIGH", +} + + +def _validate_scan_wiring(value): + """Validate scan_wiring with deprecation warnings for old names.""" + value = cv.string(value).upper().replace(" ", "_") + + # Check if using deprecated name + # Remove deprecated names in 2026.7.0 + if value in DEPRECATED_SCAN_WIRINGS: + new_name = DEPRECATED_SCAN_WIRINGS[value] + _LOGGER.warning( + "Scan wiring '%s' is deprecated and will be removed in ESPHome 2026.7.0. " + "Please use '%s' instead.", + value, + new_name, + ) + value = new_name + + # Validate against allowed values + if value not in SCAN_WIRINGS: + raise cv.Invalid( + f"Unknown scan wiring '{value}'. " + f"Valid options are: {', '.join(sorted(SCAN_WIRINGS.keys()))}" + ) + + # Return as EnumValue like cv.enum does + result = add_class_to_obj(value, EnumValue) + result.enum_value = SCAN_WIRINGS[value] + return result + + Hub75ClockSpeed = cg.global_ns.enum("Hub75ClockSpeed", is_class=True) CLOCK_SPEEDS = { "8MHZ": Hub75ClockSpeed.HZ_8M, @@ -382,9 +424,7 @@ CONFIG_SCHEMA = cv.All( cv.Optional(CONF_LAYOUT_COLS): cv.positive_int, cv.Optional(CONF_LAYOUT): cv.enum(PANEL_LAYOUTS, upper=True, space="_"), # Panel hardware configuration - cv.Optional(CONF_SCAN_WIRING): cv.enum( - SCAN_PATTERNS, upper=True, space="_" - ), + cv.Optional(CONF_SCAN_WIRING): _validate_scan_wiring, cv.Optional(CONF_SHIFT_DRIVER): cv.enum(SHIFT_DRIVERS, upper=True), # Display configuration cv.Optional(CONF_DOUBLE_BUFFER): cv.boolean, @@ -547,7 +587,7 @@ def _build_config_struct( async def to_code(config: ConfigType) -> None: add_idf_component( name="esphome/esp-hub75", - ref="0.2.2", + ref="0.3.0", ) # Set compile-time configuration via build flags (so external library sees them) diff --git a/esphome/idf_component.yml b/esphome/idf_component.yml index 045b3f9168..5903e68e8e 100644 --- a/esphome/idf_component.yml +++ b/esphome/idf_component.yml @@ -28,8 +28,8 @@ dependencies: rules: - if: "target in [esp32s2, esp32s3, esp32p4]" esphome/esp-hub75: - version: 0.2.2 + version: 0.3.0 rules: - - if: "target in [esp32, esp32s2, esp32s3, esp32p4]" + - if: "target in [esp32, esp32s2, esp32s3, esp32c6, esp32p4]" esp32async/asynctcp: version: 3.4.91 From 2947642ca5452b0aaa70958eac28a598bcb8b625 Mon Sep 17 00:00:00 2001 From: Mike Ford <60777900+HLFCode@users.noreply.github.com> Date: Sat, 17 Jan 2026 03:18:48 +0000 Subject: [PATCH 17/18] [http_request] Unable to handle chunked responses (#7884) Co-authored-by: J. Nick Koston --- esphome/components/http_request/http_request.h | 4 +--- .../components/http_request/http_request_idf.cpp | 16 +++++----------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/esphome/components/http_request/http_request.h b/esphome/components/http_request/http_request.h index 1b5fd9f00e..a8c2cdfc63 100644 --- a/esphome/components/http_request/http_request.h +++ b/esphome/components/http_request/http_request.h @@ -242,9 +242,7 @@ template class HttpRequestSendAction : public Action { return; } - size_t content_length = container->content_length; - size_t max_length = std::min(content_length, this->max_response_buffer_size_); - + size_t max_length = this->max_response_buffer_size_; #ifdef USE_HTTP_REQUEST_RESPONSE if (this->capture_response_.value(x...)) { std::string response_body; diff --git a/esphome/components/http_request/http_request_idf.cpp b/esphome/components/http_request/http_request_idf.cpp index 725a9c1c1e..1de947ba5b 100644 --- a/esphome/components/http_request/http_request_idf.cpp +++ b/esphome/components/http_request/http_request_idf.cpp @@ -213,18 +213,12 @@ int HttpContainerIDF::read(uint8_t *buf, size_t max_len) { const uint32_t start = millis(); watchdog::WatchdogManager wdm(this->parent_->get_watchdog_timeout()); - int bufsize = std::min(max_len, this->content_length - this->bytes_read_); - - if (bufsize == 0) { - this->duration_ms += (millis() - start); - return 0; + this->feed_wdt(); + int read_len = esp_http_client_read(this->client_, (char *) buf, max_len); + this->feed_wdt(); + if (read_len > 0) { + this->bytes_read_ += read_len; } - - this->feed_wdt(); - int read_len = esp_http_client_read(this->client_, (char *) buf, bufsize); - this->feed_wdt(); - this->bytes_read_ += read_len; - this->duration_ms += (millis() - start); return read_len; From 19514ccdf46cba78fac445be095ec91d34260519 Mon Sep 17 00:00:00 2001 From: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com> Date: Fri, 16 Jan 2026 23:05:59 -0500 Subject: [PATCH 18/18] Bump version to 2026.1.0b3 --- Doxyfile | 2 +- esphome/const.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Doxyfile b/Doxyfile index aa6a2f169e..4b38bb779e 100644 --- a/Doxyfile +++ b/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = ESPHome # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 2026.1.0b2 +PROJECT_NUMBER = 2026.1.0b3 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/esphome/const.py b/esphome/const.py index e99fbb8283..35ce8b3cd6 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -4,7 +4,7 @@ from enum import Enum from esphome.enum import StrEnum -__version__ = "2026.1.0b2" +__version__ = "2026.1.0b3" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_" VALID_SUBSTITUTIONS_CHARACTERS = (