mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-27 09:05:56 +03:00
[GH-ISSUE #527] Request: Configure hostname #439
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#439
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 @gepd on GitHub (Feb 18, 2018).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/527
From #513
Current workaround (I've only test it on esp32)
@tablatronix commented on GitHub (Feb 18, 2018):
I don't really understand how hostname on esp works, is this mdns hostnames?
Does it use local.* ?
@tablatronix commented on GitHub (Feb 18, 2018):
Could you set softaphostname in the _apcallback and sta after autoconnect success also?
Does this need to be in core?
@tablatronix commented on GitHub (Feb 18, 2018):
so these seem to be dhcp client ids maybe ?
I still cannot figure out when to set these, some says before , some says after ap and sta are enabled.
@tablatronix commented on GitHub (Feb 18, 2018):
I am setting before and after for sta, well see which ones work for which chip, and adjust as needed.
Obviously we can only set after if already connected etc. ( I added a reconnect to handle this scenario)
Any tips on how to test this ?
my router shows my esp32 dhcp client name correctly, so that works.
Must also test with wifi.config since it stop and start dhcp, make sure hostname still works with static ips
Using the same host name for both, not sure if we need to differentiate at this point
@gepd commented on GitHub (Feb 18, 2018):
Yes, it's dhcp client ids
I've tried:
But it makes the device crash, but if you reverse it, it works
I took that piece of code from this example, it sets AP and STA:
https://github.com/copercini/esp32-iot-examples/blob/master/WiFi_nonBlocking/WiFi_nonBlocking.ino
I'm not sure. Normally it need to be done before
WiFi.beginBut the flagSYSTEM_EVENT_AP_STARTmake me doubt where it's performed@tablatronix commented on GitHub (Feb 18, 2018):
I guess we could just use events also, but thats one more thing that could introduce bugs if its not needed. Well see
events do not work unless we can set them up before sta is enabled, which is going to be near impossible with autoconnect, and even then we need to know hostname very early, so store it, then we need to read it before start_sta, right now this is ok because autostart is not implemented yet, but it will be, I think setting it and restarting is the best most stable solution for now, although this might create issues with routers that cache the names, we will have to see, and events are also a pain , because we need to have access to the class in the event call backs to get the hostnames
@gepd commented on GitHub (Feb 19, 2018):
I've tested AP and STA in esp32 and both cases are working
Just note if you are in STA mode, STA hostname will be what you had set, and STA will be
espressifand if you are in AP will be the opposite.You can check this from the
Infosection@tablatronix commented on GitHub (Feb 19, 2018):
ok I think i have a decent working solution now
@tablatronix commented on GitHub (Feb 19, 2018):
I am just setting hostname, and reconnecting for now if already connected, else it works fine normally.
Alternative is to restart the dhcp server, but I do not think that is exposed at all.
sta hostnames confirmed with dhcp wireshark
ip.src == 0.0.0.0dhcp hostname as column@gepd commented on GitHub (Feb 19, 2018):
I've just check it and there is not problem in STA (both names are the same) but not in AP
@tablatronix commented on GitHub (Feb 19, 2018):
Esp8266 has no apname config
I have not tested esp32 aphostnames yet.
It is nor working at all?
@gepd commented on GitHub (Feb 19, 2018):
When you are in STA
STA Hostname:
newnameAP Hostname:
newnameIn AP:
AP hostname:
newnameSTA hostname:
espressifis not a big deal, but if it's fixed would be good
@tablatronix commented on GitHub (Feb 19, 2018):
which board?
@tablatronix commented on GitHub (Feb 19, 2018):
how do you test ap hostname ? I dont seem to see it coming across in wirreshark, says "server hostname not given"
@tablatronix commented on GitHub (Feb 19, 2018):
Might want to give it a try again.
On esp32 ap, info shows both
newname, I have to confirm via network of course.@gepd commented on GitHub (Feb 19, 2018):
I'm working with a ESP32
Now both cases are working.
I checked that from my router, and also from the
Infopage of WMFirst I start the portal and check the Info page (No WiFi connection) then I connect the device to a network and check it again.
Now it's working as spected.
I don't have an esp8266 here to test it
@tablatronix commented on GitHub (Feb 19, 2018):
I still cannot figure out what the aphostname actually does. Shrug,
@gepd commented on GitHub (Feb 19, 2018):
I don't know either, for me it has not sense to change it, but as it's displayed in the info page, is a little weird to read two hostnames with different names
@bitboy85 commented on GitHub (Jun 22, 2019):
I would also like to have this feature. Makes it more easy to open webserver by name instead of ip address. As far as i know hostname is only in station mode supported and if i remember correctly there were some issues with hostname and the esp8266 arduino library.
Can you please check with an updated one?
@tablatronix commented on GitHub (Jun 22, 2019):
This feature already exists.. Did you read this?
@bitboy85 commented on GitHub (Jun 22, 2019):
What i had in mind is if using autoconfiguration that you can set a hostname in the "Configure Wifi" menu. Which is also saved in flash and restored during power up.
Currently its only working if hardcoded or did i miss something?
@tablatronix commented on GitHub (Jun 22, 2019):
yes you are correct, anything that uses flash or spiffs to store stuff has to be written by users on their own using params, wifimanager does not write to flash memory on its own by design
@markg85 commented on GitHub (Jul 8, 2019):
I too ended up here after having hacked this very feature in my local WiFiManager along with mDSN support.
Just to figure out that the feature is there all along, just in the development branch... Which you obviously don't get when using PlatformIO..
Could you consider making a new release, please? These two features alone would already be welcome enough for a release.
@tablatronix commented on GitHub (Jul 8, 2019):
I will accept PR for examples on development if anyone want to write them though.
I hope to release it (beta) soon, sorry about that you can use it on platformio, you can install anything on platformio using git urls
@markg85 commented on GitHub (Jul 8, 2019):
Yes, that will work. But then i lose the update feature... This is only a good solution as long as you haven't made a release. As soon as you do, it requires me (and all who used git clone) to modify it again.
@tablatronix commented on GitHub (Jul 9, 2019):
Can you not override libraries in platformio.ini? I have not tried yet
@tablatronix commented on GitHub (Jul 9, 2019):
Yeah you just add lib deps and use the custom branch
https://docs.platformio.org/en/latest/librarymanager/quickstart.html#project-dependencies