8000
Skip to content

[wifi] Warn when AP is configured without captive_portal or web_server - #13087

Merged
bdraco merged 1 commit into
devfrom
ap_misconfigured_warn
Jan 9, 2026
Merged

[wifi] Warn when AP is configured without captive_portal or web_server#13087
bdraco merged 1 commit into
devfrom
ap_misconfigured_warn

Conversation

@bdraco
@bdraco bdraco commented Jan 9, 2026
Copy link
Copy Markdown
Member

What does this implement/fix?

Adds a warning when WiFi AP mode is configured but neither captive_portal nor web_server is enabled.

Without either of these components, the AP serves no practical purpose - users cannot:

  • Configure WiFi credentials via web interface (requires captive_portal)
  • Monitor or control the device via web interface (requires web_server)

This mirrors the existing warning in captive_portal that warns when it's enabled without wifi.ap.

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):

  • N/A

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

  • N/A

Test Environment

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

Example entry for config.yaml:

# This config will trigger the warning:
wifi:
  ssid: "MyNetwork"
  password: "secret"
  ap:
    ssid: "Fallback AP"

# No captive_portal or web_server configured

Warning message:

WARNING WiFi AP is configured but neither captive_portal nor web_server is enabled. The AP will not be usable for configuration or monitoring. Add 'captive_portal:' or 'web_server:' to your configuration.

To fix, add either:

captive_portal:
# or
web_server:

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:

Copilot AI review requested due to automatic review settings January 9, 2026 00:55
@github-actions
github-actions Bot commented Jan 9, 2026
Copy link
Copy Markdown
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#13087
    components: [wifi]
    refresh: 1h

(Added by the PR bot)

@codecov-commenter
codecov-commenter commented Jan 9, 2026
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.76%. Comparing base (012a1e2) to head (12be08f).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev   #13087   +/-   ##
=======================================
  Coverage   73.76%   73.76%           
=======================================
  Files          53       53           
  Lines       11328    11328           
  Branches     1538     1538           
=======================================
  Hits         8356     8356           
  Misses       2572     2572           
  Partials      400      400           

☔ 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.

@github-actions
github-actions Bot commented Jan 9, 2026
Copy link
Copy Markdown
Contributor

Memory Impact Analysis

Components: wifi
Platform: esp8266-ard

Metric Target Branch This PR Change
RAM 28,488 bytes 28,488 bytes ➡️ +0 bytes (0.00%)
Flash 323,115 bytes 323,115 bytes ➡️ +0 bytes (0.00%)

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.

Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a warning when WiFi Access Point (AP) mode is configured without either captive_portal or web_server components. The intent is to help users identify potential misconfigurations where an AP would serve no practical purpose for web-based configuration or monitoring.

Key changes:

  • Adds validation logic to warn when AP is configured without captive_portal or web_server
  • Refactors final_validate() to store full_config once instead of calling fv.full_config.get() multiple times for improved efficiency

Comment thread esphome/components/wifi/__init__.py
@kbx81 kbx81 left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! 🙏🏻

@kbx81 kbx81 left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks! 🙏🏻

@bdraco
bdraco commented Jan 9, 2026
Copy link
Copy Markdown
Member Author

thanks

@bdraco
bdraco merged commit 5afe4b7 into dev Jan 9, 2026
40 checks passed
@bdraco
bdraco deleted the ap_misconfigured_warn branch January 9, 2026 02:41
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 11, 2026
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.

4 participants

0