I have built a mobile application in visual studio. the purpose of this app to connect with wifi module (nodemcu esp8266) to control the home appliances. there are differents buttons options in this app to turn on and turn off the appliances and also to control the speed of fans. now the problem is that, I don't know how to read the data in nodemcu (WIFI module) when I send the command through the mobile app. consider a case : when i send comend through a app for fan speed 50%, and this command successfully deliver to nodemcu. now i dont know how i will read this command and how to control .
When the users clicks the [Set fan 50%] on the mobile device, have the mobile device send HTTP POST to your server.
When the server receives that HTTP POST, have it store the fan speed as 50% (or what ever value the button dictated).
Now, on the ESP8266, have it send an HTTP GET to the server every few seconds asking it what the fan speed should be. Have the server reply based on the value that it stored. When the ESP8266 receives the response, have it set the fan speed based on the value in that response.
--
A few things to note:
Both the mobile device and the ESP8266 need to be able to reach the server. If that server is on your home network, then both the mobile device and the ESP8266 must also be on your home network (unless you're doing some fancy routing).
There's no easy way (that I know of) to encrypt your WiFi password on the ESP8266. That means that if someone picks up the device and walks off with it, they can get your WiFi password. It's still a great device, just be aware of this.
A more secure approach would be to put the ESP8266 in access point mode. Then have another, more secure device on the network connect to the ESP8266 and send it the fan speed. (That way the ESP8266 doesn't have to store your WiFi password and the only data can be intercepted is the data that you send directly to the device.)