Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proceed if AP mode is set up #6631

Merged
merged 2 commits into from May 7, 2024
Merged

proceed if AP mode is set up #6631

merged 2 commits into from May 7, 2024

Conversation

ssieb
Copy link
Member

@ssieb ssieb commented Apr 25, 2024

What does this implement/fix?

If wifi is configured but can't connect and the AP comes up, the web server and other services are not available.

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)
  • Other

Related issue or feature (if applicable): fixes esphome/issues#3956

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

Test Environment

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

Example entry for config.yaml:

# Example config.yaml

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:

@codecov-commenter
Copy link

codecov-commenter commented Apr 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.05%. Comparing base (4d8b5ed) to head (b83d65b).
Report is 507 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6631      +/-   ##
==========================================
+ Coverage   53.70%   54.05%   +0.34%     
==========================================
  Files          50       50              
  Lines        9408     9554     +146     
  Branches     1654     1687      +33     
==========================================
+ Hits         5053     5164     +111     
- Misses       4056     4066      +10     
- Partials      299      324      +25     

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

@Hiekkaharju
Copy link

Hiekkaharju commented Apr 25, 2024

No success. See attached.
No sign of web server starting, even when AP is connected.
I believe starting of Captive portal is done the way it is for a reason.
test2.yaml.txt
test2_logs.txt

@ssieb ssieb marked this pull request as draft April 25, 2024 15:24
@ssieb
Copy link
Member Author

ssieb commented May 2, 2024

Try again. I've tested this one and it works.

@Hiekkaharju
Copy link

Thanks for yor effort. This version indeed seems to start the web server properly with or without STA-wifi presence.

BUT strangely enough I found one sequence that does not now work:
-reset the device when STA-wifi is not available - AP and webserver will start after ap_timeout
-make STA wifi available - device connects to STA-wifi and stops AP
-make STA wifi unavailable - device starts to scan for wifi. BUT it does not start AP after the ap_timeout time. Web server likely would be still running, but it can't be accessed as the AP is not.

The strangest part is that if the device is started with STA-wifi available, i.e AP is not started before STA-wifi is connected, it will start AP when STA-wifi is lost.

I tested with esphome 2024.4.1 + pr#6631, but I can't see anything in 2024.4.2 changelog that could affect this.

@ssieb
Copy link
Member Author

ssieb commented May 3, 2024

What happens in that scenario without this change?

@Hiekkaharju
Copy link

As you apparently suspected, the same happens also with pure 2024.4.1. (exept of course web server starts only when STA-wifi is connected)
I created a new issue for the the ap restart
esphome/issues#5759
Thus I think that this PR would be ready for review, merge and release.
Thanks !

@ssieb ssieb marked this pull request as ready for review May 7, 2024 03:43
@ssieb ssieb merged commit 5edf497 into esphome:dev May 7, 2024
60 checks passed
@ssieb ssieb deleted the apweb branch May 7, 2024 03:44
@jesserockz jesserockz mentioned this pull request May 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators May 9, 2024
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.

Web Server not working on AP mode when a WiFi network is configured
4 participants