mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 17:15:53 +03:00
[GH-ISSUE #1223] On Client Connect Callback? #1042
Labels
No labels
📶 WiFi
🕸️ HTTP
Branch
DEV Help Wanted
Discussion
Documentation
ESP32
Example
Good First Issue
Hotfix
In Progress
Incomplete
Needs Feeback
Priority
QA
Question
Task
Upstream/Dependancy
bug
duplicate
enhancement
invalid
pull-request
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/WiFiManager#1042
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @OldGreyCells on GitHub (Mar 6, 2021).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1223
Basic Infos
I notice the WiFiManager knows when a client connects to the Access Point:
Would it be possible to have an
onAPClientConnectCallback?Hardware
WiFimanager Branch/Release: Development
Esp8266:
Hardware: D1 Mini
Description
Problem description
Settings in IDE
Module: Wemos D1
Additional libraries:
@tablatronix commented on GitHub (Mar 6, 2021):
possibly, you could also do loop check ( non blocking mode )
@tablatronix commented on GitHub (Mar 6, 2021):
Also look at wifievents
https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiEvents/WiFiEvents.ino
@OldGreyCells commented on GitHub (Mar 6, 2021):
Thank you, I will have a look at those - I'm trying to get the trigger to change the end user prompt from "Please connect to this WiFi Access Point" to "Please use this URL if the captive portal hasn't popped up on you phone" (cos I've only seen the elusive portal automatically once!) so I'll have to see where those WiFi 'Station Connected' events pop up while in AP Mode. Will report back!
@tablatronix commented on GitHub (Mar 6, 2021):
ahh, so you want to actually detect the captive portal.. hmm
let me think on it, a callback might be the best way
A typical captive portal failure reason ,is your device is failing to get or use the aps dns.
@OldGreyCells commented on GitHub (Mar 6, 2021):
Thank you - it's all about the user experience with me! My first programming 'customer' broke everything, so I still think like he does.
I thought the lack of captive portal failure may be because it's a 'saved' network?
@tablatronix commented on GitHub (Mar 7, 2021):
Sometimes that is also a reason, mostly on IOS you MUST forget ap to get it to come back up typically.
But there is a issue on esp about android forcing google dns, and not redirecting to cp ever, also win10 and firewalls.
basically captive portals are not foolproof or 100% reliable as they are entirely non standard
Another issue with trying to detect this is that every single request hits the captive portal as a request, every background service, every polling update check, maybe we can detect requester by user agent...
@tablatronix commented on GitHub (Mar 7, 2021):
You know I have been trying to identify captive portals also for ota, as upload forms do not work. RIght now it just says goto ip on the page..
@OldGreyCells commented on GitHub (Mar 7, 2021):
It would appear the callback I require is
WiFi.onSoftAPModeStationConnected()- this is fired when a client connects to a bare (ieWiFiManagernot installed, flash erased) ESP8266. It would seem an AP is created automatically by the core WiFi lib but if I go to 192.168.4.1 I get 'Connection Refused' rather than the expected 'Address unreachable' which implies something is running on the ESP...The
WiFi.onSoftAPModeStationConnected()event has two members:.aid- appears to be the number of the the client (ie 1 for the first, 2 for the second)..mac- I haven't yet matched to the client mac but is different for each one...Still digging.
Update: the on my phone, the 'IP Address' shows as '192.168.4.2' (assigned by the ESP?) along with a string that matches the
.macvalue - IPV6?@OldGreyCells commented on GitHub (Mar 7, 2021):
On the basis it looks like the
WiFi.onSoftAPModeStationConnected()callback meets the requirement, feel free to close this without creating a callback (following the *nix 'do one thing well' principle').