WiFiAPMode doesn't work again

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

WiFiAPMode doesn't work again

#1 Post by chromo23 » 16 Mar 2023, 12:01

I used yesterdays build and realized that "WiFiAPMode" doesn’t work. I am not entirely sure, but i think it was already working a while ago...

Code: Select all

185317 : Info   : HTTP: WifiAPMode
185425 : Info   : WIFI : Set WiFi to AP+STA
185535 : Info   : WIFI : AP Mode ssid will be chickendoor with address 192.168.4.1
185561 : Info   : WIFI : Disconnected! Reason: '(8) Assoc leave' Connected for 2 m 10 s
185562 : Info   : WIFI : Arduino wifi status: WL_IDLE_STATUS 0 ESPeasy internal wifi status: Conn. IP Init
185663 : Info   : WiFi : WifiDisconnect()
185764 : Info   : WIFI : Disconnected! Reason: '(1) Unspecified'
185865 : Info   : Reset WiFi.
185867 : Info   : WiFi : Start network scan all channels
188055 : Info   : WiFi : Best AP candidate: *********************** Ch:9 (-41dBm) WPA2/PSK
188056 : Info   : WiFi : Scan finished, found: 14
188059 : Info   : WiFi : Best AP candidate: *********************** Ch:9 (-52dBm) WPA2/PSK
188060 : Info   : WiFi : Added known candidate, try to connect
188061 : Info   : WiFi : WifiDisconnect()
188163 : Info   : WIFI : Disconnected! Reason: '(1) Unspecified'
188164 : Info   : WIFI : Arduino wifi status: WL_IDLE_STATUS 0 ESPeasy internal wifi status: DISCONNECTED
188265 : Info   : Reset WiFi.
188268 : Info   : WiFi : Start network scan all channels
190455 : Info   : WiFi : Scan finished, found: 12
190458 : Info   : WiFi : Best AP candidate: *********************** Ch:9 (-51dBm) WPA2/PSK
190460 : Info   : WiFi : Added known candidate, try to connect
190561 : Info   : WIFI : Arduino wifi status: WL_IDLE_STATUS 0 ESPeasy internal wifi status: DISCONNECTED
190562 : Info   : WIFI : Set WiFi to OFF
190879 : Info   : WIFI : Set WiFi to STA
190985 : Info   : WIFI : Connecting *********************** Ch:9 (0dBm) - attempt #2
191001 : Info   : EVENT: WiFi#APmodeEnabled
192027 : Info   : EVENT: WiFi#Disconnected
192160 : Info   : WIFI : DHCP IP: 192.168.1.107 (chickendoor) GW: 192.168.1.1 SN: 255.255.255.0 DNS: 192.168.1.1 / (IP unset)   duration: 141 ms
192166 : Info   : WIFI : Arduino wifi status: WL_CONNECTED 3 ESPeasy internal wifi status: IP 
192168 : Info   : WD   : Uptime 3 ConnectFailures 0 FreeMem 14344 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: IP 
192176 : Info   : WIFI : Connected! AP: *********************** Ch: 9 Duration: 1017 ms
192183 : Info   : EVENT: Clock#Time=Thu,10:53
192291 : Info   : EVENT: WiFi#Disconnected
192405 : Info   : EVENT: WiFi#Disconnected
192512 : Info   : EVENT: WiFi#APmodeDisabled
192625 : Info   : EVENT: WiFi#Connected
192737 : Info   : EVENT: WiFi#ChangedAccesspoint
192846 : Info   : EVENT: WiFi#ChangedWiFichannel

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: WiFiAPMode doesn't work again

#2 Post by chromo23 » 16 Mar 2023, 12:17

I found a workaround:

Code: Select all

On APMode Do
  WiFiDisconnect
  WiFiAPMode
Endon
It seems, that executing a disconnect before starting an AP solves the problem...

Edit: …and successfully start the ap+sta mode

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: WiFiAPMode doesn't work again

#3 Post by TD-er » 16 Mar 2023, 12:33

Yep, this is still an issue.
Has been for quite some time already as I have an open PR for it to make it work again.
But while working on that one, I ran into serious issues where toggling the WiFi actually messed up a node so badly that it wouldn't be able to use WiFi until it was completely flashed again.
So that one will probably not be merged ever....

My idea to finally fix this is to add explicit network medium settings.

So you should then explicitly use any of these (not limited to as this is typed from memory)

- WiFi OFF
- WiFi STA
- WiFi AP
- WiFi AP+STA
- ESPEasy-NOW mesh only
- WiFi STA + ESPEasy-NOW
- Ethernet + WiFi OFF
- Ethernet + ESPEasy-NOW mesh

And there will be some more in the future...

This would then also allow for features like "delayed WiFi start" for poorly designed units like Sonoff Basic just to name one.
And only turn on WiFi if some pin is high (e.g. deep sleep node + solar panel)

But this again needs a very thorough look at the network code, so you may understand my hesitation.

User avatar
chromo23
Normal user
Posts: 821
Joined: 10 Sep 2020, 16:02
Location: germany

Re: WiFiAPMode doesn't work again

#4 Post by chromo23 » 16 Mar 2023, 12:42

TD-er wrote: 16 Mar 2023, 12:33 But this again needs a very thorough look at the network code, so you may understand my hesitation.
I absolutely unterstand. Reliable working WiFi is somewhat essential for these kind of microcontroller :D
For now my "workaround" seems to work so i am happy and there is no rush... :)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 27 guests