Skip to content

Conversation

@swoboda1337
Copy link
Member

What does this implement/fix?

Prevents noisy error logs on startup when the http_request update component attempts to fetch the manifest before WiFi is connected.

The scheduler triggers the first interval update within 0-5 seconds of setup (due to MAX_INTERVAL_DELAY = 5000ms), but WiFi typically takes 5-10+ seconds to connect. This causes the update component to fail with errors like:

[E][component:315]: http_request.update set Error flag: Failed to fetch manifest
[E][component:315][update_task]: http_request set Error flag: unspecified
[E][http_request.idf:061][update_task]: HTTP Request failed; Not connected to network
[E][http_request.update:052][update_task]: Failed to fetch manifest from https://...

This change adds a network::is_connected() check at the start of update() that silently skips the update check (with a DEBUG log) when the network isn't ready. The regular polling interval (default 6 hours) will check once connected, or users can trigger an immediate check via wifi.on_connect + update.check action.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Developer breaking change (an API change that could break external components)
  • Code quality improvements to existing code or addition of tests
  • Other

Related issue or feature (if applicable):

Pull request in esphome-docs with documentation (if applicable):

  • N/A (no documentation changes needed)

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx
  • nRF52840

Example entry for config.yaml:

# No config changes needed - this is an automatic behavior improvement
# The update component will now silently skip checks until network is ready

update:
  - platform: http_request
    name: Firmware Update
    source: "https://example.com/manifest.json"

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

  • Documentation added/updated in esphome-docs. (N/A - no user-facing config changes)

Prevents noisy error logs on startup when the http_request update
component attempts to fetch the manifest before WiFi is connected.

The scheduler triggers the first interval update within 0-5 seconds
of setup, but WiFi typically takes 5-10+ seconds to connect. This
change silently skips the update check (with a DEBUG log) when the
network isn't ready, relying on the regular polling interval or
manual update.check action to check once connected.

Closes esphome#12416

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file:

external_components:
  - source: github://pr#12418
    components: [http_request]
    refresh: 1h

(Added by the PR bot)

@github-actions
Copy link
Contributor

👋 Hi there! I've automatically requested reviews from codeowners based on the files changed in this PR.

@jesserockz - You've been requested to review this PR as codeowner(s) of 1 file(s) that were modified. Thanks for your time! 🙏

@codecov-commenter
Copy link

codecov-commenter commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.56%. Comparing base (27e031c) to head (6b2e603).
⚠️ Report is 39 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #12418      +/-   ##
==========================================
- Coverage   72.58%   72.56%   -0.02%     
==========================================
  Files          53       53              
  Lines       11189    11192       +3     
  Branches     1516     1517       +1     
==========================================
  Hits         8121     8121              
- Misses       2675     2677       +2     
- Partials      393      394       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@swoboda1337 swoboda1337 added this to the 2025.12.0b2 milestone Dec 11, 2025
@github-actions
Copy link
Contributor

Memory Impact Analysis

Components: http_request
Platform: esp8266-ard

Metric Target Branch This PR Change
RAM 62,132 bytes 62,132 bytes ➡️ +0 bytes (0.00%)
Flash 883,286 bytes 883,510 bytes 📈 🔸 +224 bytes (+0.03%)
📊 Component Memory Breakdown
Component Target Flash PR Flash Change
[esphome]http_request 13,524 bytes 13,615 bytes 📈 🔸 +91 bytes (+0.67%)
cpp_runtime 7,616 bytes 7,621 bytes 📈 +5 bytes (+0.07%)
🔍 Symbol-Level Changes (click to expand)

Changed Symbols

Symbol Target Size PR Size Change
esphome::http_request::HttpRequestUpdate::update() 6 bytes 52 bytes 📈 +46 bytes (+766.67%)
ArduinoJson::V742PB22::detail::JsonSerializer<ArduinoJson::V742PB22::detail::Writer<std::__cxx11:...ArduinoJson::V742PB22::detail::JsonSerializer<ArduinoJson::V742PB22::detail::Writer<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, void> >::result_type ArduinoJson::V742PB22::detail::VariantData::accept<ArduinoJson::V742PB22::detail::JsonSerializer<ArduinoJson::V742PB22::detail::Writer<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, void> > >(ArduinoJson::V742PB22::detail::JsonSerializer<ArduinoJson::V742PB22::detail::Writer<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, void> >&, ArduinoJson::V742PB22::detail::ResourceManager const*) const [$isra$0]
607 bytes 612 bytes 📈 +5 bytes (+0.82%)

New Symbols (top 15)

Symbol Size
esphome::http_request::HttpRequestUpdate::update()::__pstr__ 45 bytes

Note: This analysis measures static RAM and Flash usage only (compile-time allocation).
Dynamic memory (heap) cannot be measured automatically.
⚠️ You must test this PR on a real device to measure free heap and ensure no runtime memory issues.

This analysis runs automatically when components change. Memory usage is measured from a representative test configuration.

@swoboda1337 swoboda1337 requested a review from bdraco December 12, 2025 13:59
@swoboda1337
Copy link
Member Author

Thanks

@swoboda1337 swoboda1337 merged commit d30d815 into esphome:dev Dec 12, 2025
36 checks passed
swoboda1337 added a commit that referenced this pull request Dec 12, 2025
Co-authored-by: Claude <noreply@anthropic.com>
@swoboda1337 swoboda1337 mentioned this pull request Dec 12, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Managed Updates attempt to fetch manifest before network is connected

3 participants