2

I would like to connect the nodemcu to some LEDs, running a HTTP server (RESTful presumably) and turn on/off accordingly. However, how can the devices in the same network find the device? I guess I could try static IP for esp8266, but that is not guarantee to work every time everywhere. So how can I scan the network to find that, or is there any better solution?

Louis Tsai
  • 1,587
  • 3
  • 20
  • 33

2 Answers2

0

I think most people use multicast DNS (mdns) for this, a quick Google should give you some examples for the environment you use :)

I like using MQTT, which is a different protocol that uses a central broker, but it's probably not quite what you want.

Also, why would a fixed IP not work? Most routers allow to assign one based on MAC address, which should work consistently.

And finally, you should be able to set a hostname for the ESP (wifi_station_set_hostname in the ESP SDK, which I think you can call from Arduino also), which should make it known with your router under that name.

bluemind
  • 1,591
  • 11
  • 16
0

I set my DHCP server to always give the same IP address to my NodeMCUs based on their MAC addresses. They are also configured with mDNS but I don't have mDNS on my Android phone so it didn't help me.

leetibbett
  • 843
  • 4
  • 16