graybushlabs / NodeMCU

A collection of NodeMCU projects
0 stars 0 forks source link

Hostname not set properly #1

Closed graybushlabs closed 2 months ago

graybushlabs commented 3 months ago

This should be applied to all sketches once the test is done

The NodeMCU has 2 ways to set the hostname and the order of operations appears to be important. The gist of the posts is that you need to

  1. WiFi.mode(WIFI_STA);
  2. WiFi.hostname(hostname.c_str());
  3. WiFi.begin(SSID, PASSWORD);

See also: https://randomnerdtutorials.com/esp8266-nodemcu-set-custom-hostname-arduino/