I'm working on a project which connects a NodeMCU to a Raspberry Pi, which is operating as a server. I want to make requests to the Raspberry from the NodeMCU without knowing its IP address. The Raspberry host name is simply "raspberrypi", and I'm able to make requests using this hostname through Postman or any other browsers. Now I want to make these requests using NodeMCU (I'm using ESP libraries). What I want to do is that my requests depends only on a hostname, and not an IP (because the router may change it, and the service cannot stop working). But something really strange is happening.
If I use my own WiFi (provided by a router), and try
http.begin("raspberrypi.local", 3000, "/test");
But what is really strange is that if I start a HotSpot with my Android phone, and connect the NodeMCU and the Raspberry, and try
http.begin("raspberrypi.local", 3000, "/test");
The Raspberry is running Avahi, but things don't work unless I'm on my Android hotspot (I tested other WiFi networks with no success). I really need this functionality to work on my project, or anything that makes it no dependable on IP addresses. Is there anyway someone could help me out?
Thanks!