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

Static IP in ElegantOTA AsyncDemo #238

Closed
renegat56 opened this issue Dec 12, 2024 · 4 comments
Closed

Static IP in ElegantOTA AsyncDemo #238

renegat56 opened this issue Dec 12, 2024 · 4 comments

Comments

@renegat56
Copy link

renegat56 commented Dec 12, 2024

ElegantOTA works pretty well with DHCP. But I have to set a static IP in my wlan net due to several reasons.
So I inserted :

// config for static ip
WiFi.config(myip,gateway,subnet,dns1,dns2);

after :

WiFi.mode(WIFI_STA)

and before :

WiFi.begin(ssid, password)

like usually.

But with ElegantOTA it does not work. I can reach the ESP with http://ip and get the info :

"Hi! This is ElegantOTA AsyncDemo."

But not with http://ip/update. And after trying this, http://ip does not work anymore too.

How can I set static IP? With ESP8266HTTPUpdateServer I got it working with static IP

Thanks!

@mathieucarbou
Copy link
Contributor

FYI I am using ElegantOTA in an app and using static IP on ETH and WiFi.
So I know it works ;-)

@renegat56
Copy link
Author

Hi Mathieu,

it's good to know, that it works, but do you have any idea or hint what I'm doing wrong?
All my other ESP8266 modules work with static IP (no OTA, only one with ESP8266HTTPUpdateServer) very good. And I always put the WiFi.config() at this place in code. The strange thing is from WiFi.localIP() I get the assigned static IP and the first call http://staticip from webbrowser works too and returns the sentence from source code.

@mathieucarbou
Copy link
Contributor

I do exactly like you so this might be something else...
make sure to call begin() on the server AFTER the network stack is ready.

@renegat56
Copy link
Author

So you were right Mathieu.
It was something different. My DHCP server bind9 made the problem. In his files the ESP was registered with the DHCP IP. After I changed in those files the IP to my static IP ElegantOTA worked with the static IP.
Thx for your help!

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