Hi,
I have my project running on an ESP32 NodeMCU and my own local Blynk server. I need to somehow make my ESP32 NodeMCU have a static IP address on my network so I can do some OTA updates. Any ideas how to make this happen when using the Blynk code?
Steve
You donโt need to have a static IP to do OTA. If you define an OTA hostname for each device then you can easily identify them when selecting the correct network port.
ArduinoOTA.setHostname("device name in here");
Pete.
So the examples in that library donโt use IP addresses to identify devices, they use MDNS names.
However, to answer your original question, you should probably use Blynk.config and Blynk.connect rather than Blynk.begin, which is a much nicer approach anyway in my opinion.
This requires you to set-up your own network connection which would probably use some code that looks a bit like this:
WiFi.config(device_ip, dns, gateway, subnet);
if (WiFi.status() != WL_CONNECTED)
{
WiFi.begin(ssid, pass); // connect to the network
}
while (WiFi.status() != WL_CONNECTED
{
delay(1000);
}
Pete.