mirror of
https://github.com/tzapu/WiFiManager.git
synced 2026-04-28 01:25:49 +03:00
[GH-ISSUE #1014] Setting the hostname #862
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#862
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 @fmarzocca on GitHub (Feb 26, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1014
I am wondering when is the right point to set the hostname (
WiFi.hostname(BASE_HOST_NAME);)of the esp8266 to avoid it show itself in the LAN with ESP_xxxxx?@tablatronix commented on GitHub (Feb 27, 2020):
Well if you set the mode to OFF it will remember it and not auto start the ap. Thats an esp thing not a wm
@fmarzocca commented on GitHub (Feb 27, 2020):
@tablatronix , sorry but it wasn't clear to me. Which mode should I set to OFF? I need the AP the first time.... Where should I include WiFi.hostname(BASE_HOST_NAME) ??
@tablatronix commented on GitHub (Feb 27, 2020):
setup(){
WiFi.mode(WIFI_STA);
}
@fmarzocca commented on GitHub (Feb 27, 2020):
I am confused... how can WiFi.mode() be
able to set the device hostname?
Il Gio 27 Feb 2020, 13:37 Shawn A notifications@github.com ha scritto:
@tablatronix commented on GitHub (Feb 27, 2020):
Your problem has nothing to do with hostname, esp starts ap by default
@fmarzocca commented on GitHub (Feb 27, 2020):
Sorry, maybe I wasn't clear in my question.
My device is working very well with WifiManager. The first time it starts in AP mode, I set the credentials and then every time it starts again it connects to the WiFi router.
My problem is that at this point the device is present on the LAN with ESP-xxxxx hostname, while I'd like to assign it to a more specific hostname.
How to assign it the hostname and where in the sequence of setup() instructions?
@tablatronix commented on GitHub (Feb 27, 2020):
oh are you talking about mdns hostnames? I thought you mean the ssid was showing up.
Sorry I misunderstood
If you are using autoconnect, you can set it before you call autoconnect, it doesn't get set until you call autoconnect, there have been some changes to mdns, I think you might have to service it in loop now, not sure.
@fmarzocca commented on GitHub (Feb 27, 2020):
Ah, ok.
So this way:
@tablatronix commented on GitHub (Feb 27, 2020):
yup
WiFi.hostname(BASE_HOST_NAME); // <---- MDNS network hostname dhcp client name
if (!wifiManager.autoConnect(BASE_HOST_NAME)) { // <---- SOFT AP SSID
depending on the version of your libs, you probably have to add this to your loop to get hostname resolution to work properly
@fmarzocca commented on GitHub (Feb 27, 2020):
Thanks!
@tablatronix commented on GitHub (Feb 27, 2020):
Here is the code if you are curious or want to do it yourself in your code,
@thijstriemstra commented on GitHub (Jan 22, 2025):
Suggestions above didn't work. For an ESP32 I only had to add
wifiManager.setHostname("MyHostname");insetup()