Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Static IP for Wifi. #5

Closed
dpackham opened this issue Dec 30, 2018 · 3 comments
Closed

Add Static IP for Wifi. #5

dpackham opened this issue Dec 30, 2018 · 3 comments

Comments

@dpackham
Copy link

Adding the option of a static IP will allow the ESP to boot much quicker.

@dpackham
Copy link
Author

In the "user config section" as well to keep it clean

@thehookup
Copy link
Owner

I don't see this getting implemented. I'm betting someone who wants a static IP can handle editing the 4 lines of code required for changing to static IP.

@dpackham
Copy link
Author

dpackham commented Jan 6, 2019

I understand. but if you get comments about it taking forever to connect this will help

This makes my ESP connect is two dots and without it sometimes takes minutes.

// Static IP address for the nodeMCU
// uncomment the below WIFI_STATIC_IP for a static IP and faster reconnects
//#define WIFI_STATIC_IP
//IPAddress ip(10, 1, 1, 190);
//IPAddress gateway(10, 1, 1, 1);
//IPAddress subnet(255, 255, 255, 0);

and below add

ifdef WIFI_STATIC_IP
WiFi.config(ip, gateway, subnet);
#endif

above

WiFi.persistent(false);
WiFi.hostname(USER_MQTT_CLIENT_NAME);
WiFi.begin(ssid, password);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants