-->
Page 3 of 5

Re: How do you REALLY change the host name?

PostPosted: Sat Aug 06, 2016 9:05 am
by martinayotte
Are you in AP mode or AP_STA mode ?
Because for AP-only mode, it will never appear in your router since it doesn't even try to connect to it.

Re: How do you REALLY change the host name?

PostPosted: Thu Aug 11, 2016 5:00 pm
by JimDrew
It must be in AP_STA mode (I don't change it in my code)... but I see the ESP8266 when I do a Wifi scan with my iPhone, PC, etc.

The name is the typical ESP_ with part of the MAC address.

Re: How do you REALLY change the host name?

PostPosted: Thu Aug 11, 2016 5:40 pm
by martinayotte
What can I say other than "it works for me" ... ;)

Maybe you should try connecting the same way I'm doing (maybe the WiFi.reconnect() is the reason) :

Code: Select allsetup() {
  char HostName[32];
  sprintf(HostName, "MyESPAP-%06X", ESP.getChipId());
  Serial.printf("Hello from %s !\r\n", HostName);
  Serial.println("Configuring Access Point ...");
  wifi_station_set_hostname(HostName);
  WiFi.softAP(HostName, password);
  WiFi.mode(WIFI_AP_STA);
  if (WiFi.SSID().length() > 0) {
    Serial.printf("ReConnecting to Remote AP '%s' ...\r\n", WiFi.SSID().c_str());
    WiFi.reconnect();
  }
  // more setup code here for other stuff
}

Re: How do you REALLY change the host name?

PostPosted: Fri Aug 12, 2016 2:43 pm
by JimDrew
I don't have any of this:

Code: Select all  WiFi.softAP(HostName, password);
  WiFi.mode(WIFI_AP_STA);
  if (WiFi.SSID().length() > 0) {
    Serial.printf("ReConnecting to Remote AP '%s' ...\r\n", WiFi.SSID().c_str());
    WiFi.reconnect();
  }