[GH-ISSUE #1622] Force MDNS restart after connection (NONBlockling) #1383

Open
opened 2026-02-28 01:29:51 +03:00 by kerem · 10 comments
Owner

Originally created by @Shumatic on GitHub (Jun 7, 2023).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1622

Basic Infos

Hardware

WiFimanager Branch/Release: Master 2.0.16-rc.2

Esp8266:

Hardware: ESP-12e

Core Version: 2.4.0, staging

Description

Is there a callback function to indicate that a connection is made?
When using NONblocking and MDNS, it connects fine, but MDNS takes a long time to initialize,
so i would like to force a MDNS restart.

Settings in IDE 1.8.13

Module: Generic

Originally created by @Shumatic on GitHub (Jun 7, 2023). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1622 ### Basic Infos #### Hardware WiFimanager Branch/Release: Master 2.0.16-rc.2 Esp8266: Hardware: ESP-12e Core Version: 2.4.0, staging ### Description Is there a callback function to indicate that a connection is made? When using NONblocking and MDNS, it connects fine, but MDNS takes a long time to initialize, so i would like to force a MDNS restart. ### Settings in IDE 1.8.13 Module: Generic
Author
Owner

@tablatronix commented on GitHub (Jun 8, 2023):

hmm on esp8266 you have to explicitly run mdns, maybe there is a problem there.

<!-- gh-comment-id:1582935295 --> @tablatronix commented on GitHub (Jun 8, 2023): hmm on esp8266 you have to explicitly run mdns, maybe there is a problem there.
Author
Owner

@Shumatic commented on GitHub (Jun 9, 2023):

hmm on esp8266 you have to explicitly run mdns, maybe there is a problem there.

No, i am aware of this, and i have MDNS.begin ( "name" ) ) in setup.
If ESP dosnt have a WiFi connection when booted, it still setup MDNS, and when i configure WiFi through the WiFimaneger it connects, but it isn't possile to reach from "name" only ip. It takes more then an hour before it works.

<!-- gh-comment-id:1584285776 --> @Shumatic commented on GitHub (Jun 9, 2023): > hmm on esp8266 you have to explicitly run mdns, maybe there is a problem there. No, i am aware of this, and i have MDNS.begin ( "name" ) ) in setup. If ESP dosnt have a WiFi connection when booted, it still setup MDNS, and when i configure WiFi through the WiFimaneger it connects, but it isn't possile to reach from "name" only ip. It takes more then an hour before it works.
Author
Owner

@tablatronix commented on GitHub (Jun 9, 2023):

If you use WM non blocking it handles this for you.

Otherwise I think you are suppose to call this in loop
'MDNS.update();'

Maybe this is outdated, I will have to check the docs and code for esp mdns.

But give that a try in case its not working?

I will investigate this for a bug, sounds like it might be, or not starting mdns when no connection

Also confirm there is no delays in loop and you are calling wm.process() often enough

<!-- gh-comment-id:1584527732 --> @tablatronix commented on GitHub (Jun 9, 2023): If you use WM non blocking it handles this for you. Otherwise I think you are suppose to call this in loop 'MDNS.update();' Maybe this is outdated, I will have to check the docs and code for esp mdns. But give that a try in case its not working? I will investigate this for a bug, sounds like it might be, or not starting mdns when no connection Also confirm there is no delays in loop and you are calling wm.process() often enough
Author
Owner

@Shumatic commented on GitHub (Jun 10, 2023):

Thanks
When i reboot after i have set WiFi, it works fine.
I have tried to force both MDNS.update() and MDNS.begin(xxx) with a botton, but it dosnt work.
Shouldnt the ESP restart automatically after WiFi have been set?
i think that would solve it.

<!-- gh-comment-id:1585630693 --> @Shumatic commented on GitHub (Jun 10, 2023): > Thanks When i reboot after i have set WiFi, it works fine. I have tried to force both MDNS.update() and MDNS.begin(xxx) with a botton, but it dosnt work. Shouldnt the ESP restart automatically after WiFi have been set? i think that would solve it.
Author
Owner

@tablatronix commented on GitHub (Jun 10, 2023):

mdns stop start?

<!-- gh-comment-id:1585670533 --> @tablatronix commented on GitHub (Jun 10, 2023): mdns stop start?
Author
Owner

@Shumatic commented on GitHub (Jun 11, 2023):

Hi Thers no Start stop mdns....

<!-- gh-comment-id:1586080607 --> @Shumatic commented on GitHub (Jun 11, 2023): Hi Thers no Start stop mdns....
Author
Owner

@tablatronix commented on GitHub (Jun 11, 2023):

.end() sorry

<!-- gh-comment-id:1586188698 --> @tablatronix commented on GitHub (Jun 11, 2023): .end() sorry
Author
Owner

@Shumatic commented on GitHub (Jun 14, 2023):

I havent tested properly...
when i set WiFi throug WiFimanager, and it reboots, i cant connect to it with IP either, i need to restart. so it isnt a MDNS problem

<!-- gh-comment-id:1590958407 --> @Shumatic commented on GitHub (Jun 14, 2023): I havent tested properly... when i set WiFi throug WiFimanager, and it reboots, i cant connect to it with IP either, i need to restart. so it isnt a MDNS problem
Author
Owner

@tablatronix commented on GitHub (Jun 14, 2023):

Thats strange, esp lib up to date?

<!-- gh-comment-id:1591084118 --> @tablatronix commented on GitHub (Jun 14, 2023): Thats strange, esp lib up to date?
Author
Owner

@Shumatic commented on GitHub (Jul 4, 2023):

Thats strange, esp lib up to date?

Hi, Thanks for still helping me out.....
Tested some more, and it is the same, when i put in credentials, it connect and get NTPsync, but i cant connect, even throug IP .
Another thing, if I put in a wrong password, and connect fails, it reboot portal, and i can correct PW, but it still dosnt work, i have to go in portal and ERASE WiFIconfig, then i can set theright PW.
All libs and esp updated and IDE is 2.1.1

<!-- gh-comment-id:1620033310 --> @Shumatic commented on GitHub (Jul 4, 2023): > Thats strange, esp lib up to date? Hi, Thanks for still helping me out..... Tested some more, and it is the same, when i put in credentials, it connect and get NTPsync, but i cant connect, even throug IP . Another thing, if I put in a wrong password, and connect fails, it reboot portal, and i can correct PW, but it still dosnt work, i have to go in portal and ERASE WiFIconfig, then i can set theright PW. All libs and esp updated and IDE is 2.1.1
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#1383
No description provided.