I am working on a small IoT personal project with some esp32 powered devices. The devices are controlled with a web interface, and all have the same program inside, basically a multifunction timer with sensors and relays. Interface is driven by Esp32AsyncWebserver. I have a “let’s look it up in StackOverflow” programming knowledge and I was able to get them running and working fine. I also designed the PCB and got it manufactured for cheap in China, and that is WAY more that I expexted I was able to do!
Now the problem: I would like to setup a “Controlling interface” where all the devices are showing up, as many IoT apps do (see: Google >Home, TP-Link Tapo etc), and I’m not able to conjure up something working. This is what I tried so far:
- first approach eas to give each device an unique, hardcoded, fixed IP then creating a static HTML linking to each device. I would like to avoid this as I would need to program each device one by one, make a list of the devices-IPs, reserve the IPs in the router so that they are not assigned to other stuff in the network. This would also prevent me to bring them with me and hook them up into someone’s else wifi (they have an inbuilt wifi manager so moving them around would not be a problem “per se”)
- I then tried an HTML page with a JavaScript function to scan my network. First approach was to give all the devices a specific Hostname and look for it, but apparently JS is not able to read Local Network Hostnames, or at least I couldn’t find how. I then tried adding a “ping_me” page in each device and ask JS to scan my network for any active “http:192.168.1.xping_me” page, and that kind of worked, only problem is that the fetch() function in JS takes ages to give up a non existing IPs. It took nearly 5 minutes to run through a 10 IP test range
- As a last, desperate attempt I also gave a try to AI app generators. Browser based ones told me that “browser cannot do what I ask due to browser limitations”. Native android app generators did’t work at all (wouldn’t say :D)
- I’ve seen the Arduino IoT library but I’d rather to keep things “local” and not “cloud”
Given my absolute lack of knowledge in Android app creation, I still think that the HTML+JS approach is the best approach. Is there any way to have a fast network scan in JS, something like “check if IP is used and look for the ping_me page only for existing >IPs”? I’m also open to suggestions for other approaches to the problem.
Thanks in advance to anyone who will try help! 🙂