0

Currently I am trying to access a rest API from NodeMCU. The API is hosted on my local LAN on a Raspberry pi 3 b. The Raspberry pi is accessible on LAN using the raspberrypi.local domain address. But the problem is I am unable to access the raspberrypi.local address form NodeMCU. It is unable to just resolve the address. Can anyone please help me resolve this issue?

3

In order to access the API, your NodeMCU needs to know the IP address your Pi has at this time. There are several ways to resolve raspberrypi.local to the actual IP. Assuming the NodeMCU got its IP assigned by your WiFi hotspot, it also received a DNS server IP. This is where the NodeMCU would ask first. However, if this DNS server is hosted by your internet provider, it obviously would not know what to respond when asked for your raspberrypi.local.

Another way, especially for .local domains, is mDNS. NodeMCU has a module to do that.

If you work with this a lot, consider running a local development network with your own DHCP/DNS combo. dnsmasq is a good place to start. Lots of tutorials online. The Pi can host that for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.