I want to make an app through which user can scan for available networks and connect to esp8266 within the app.
then I want to retrieve device IP and store it through API. so I can use it to control this ESP8266.
Now I have read somewhere that over network a device IP might keep changing, Any idea on how I can achieve what I want?
The purpose is a user-friendly app, and to make everything dynamic.
I moved your post to "project guidance" as it was not a product showcase.
an app for which platform?
you could
- setup a Access point use WiFi.scanNetworks() to get a list of local network SSIDs
- list the SSID on the screeb
- select the one you require and open a Station Mode connection to the WiFi network
many home WiFi devices use this technique, e.g. on startup creates an AP, displays SSIDs, you select one and it connects, etc etc
please be more specific. For me it is unclear if you need to scan for wifis on the ESP or the App.
To be able to "connect to the esp8266" the ESP and the device with the "app" need to be already in the same network.
Both devices are connected to the same network, but none of the two does know the IP of the other. Is that the starting point?
When the ESP and the "App" are connected to the same network, you can do following:
- on the ESP register a specific MDNS service, for example "HELLOGUY" on port 8080
- on the App start a "MDNS Service Discovery" and scan for devices which offer the service "HELLOGUY" on port 8080. As result you will get the IP of the ESP. Now you can connect to the ESP by the current IP
some weeks ago I have written following page:
https://werner.rothschopf.net/microcontroller/202310_arduino_esp_netscanner_en.htm
you will find further information on MDNS SD there.
an app for android and ios platforms.
I want the app to scan for wifi devices available, through which user can directly connect to esp8266 devices. The problem I am facing is that user will be connecting to more than one esp8266 devices, so I want the process to be dynamic and professional for a non-technical user and the app to manage all the devices in one place.
yes, I am planning to do that exactly, all I am concerned about is the IP that can change overtime for a device. Will that be an issue in future? and also how can I get IP of device allocated by the wifi to that particular device.
OK.
- Learn how to program in Swift and Kotlin and write the app...
- pay someone to do it
•••
I have gotten the app part down, I am a developer
The IP part is the challenging one
may be give answer #4 a second try.
MDNS SD can do it.
in post 1 you mentioned the ESP8266 which does not support Bluetooth Classic or BLE only WiFi - are you thinking of using a webpage on android or ios?
if you wish to use Bluetooth Classic or BLE switch to an ESP32
on iOS you won't get the list of WiFi networks and join a network without special entitlements for privacy and security reasons (see Hotspot Helper)
in Android I think you would use the WifiManager APIs but the end user would have to confirm an entitlement. It might even be as restrictive as on iOS, long time I've not played with Android.
no I wish to use wifi actual;y
right, thanks
yes I found that helpful, and I will give it a try for sure.
The local IP is issued by your router, there it set at dynamic IP, this will allow the addresses to change after there lease time is up. If you use fixed IP they will not change, mine is set for both with a given range for certain items. This is also how the internet works. Your Internet supplier can use fixed IP or Dynamic IP, you need to discuss this with them.
the thing is, I am making this for users, and not just for myself.
Is there a demand for that? How will your app know all the possible APIs to use once you have joined a given access point?
When i want my esp based projects to be discoverable I use WiFiManager to offer a captive portal experience and automatically present a web UI straight from the WiFi network chooser built into my client device. No need for a specific app.
For which users? users of your program?
Or your goal to make life easier for esp8266 users around the world? ![]()
I think I should explain my project a bit more for you to understand that.
I am using esp8266 to control appliances automatically by a schedule generated by an API to achieve a certain purpose.
And I want for this product to be user-friendly, i.e. a user shouldn't have to worry about getting the IP address of a device, or to change dynamic to static IPs, a user should be able to just connect to this wifi device through my app, and then the program can just recognize it as some specific device to implement the schedule.
Inspiration is in the link below, how a user can directly connect to the device without having to worry about anything.