alon24 wrote:Does this code mean, that the led controller needs to be logged in to the home wifi, or can you communicate with it, when it's on a different network or different ap
Yes, without a significant amount of hackery, the ESP server has to be on the same network. UPnP is used here simply to get the ESP IP address on the local network - in the case of Windows just by double clicking the device that shows up in Computer>Network. More sophisticated uses are possible (e.g. pubish & subscription of UPnP services) but it gets deep quite quickly from here in.
To get the IP It's also possible to use 3rd party utilities or apps that scan the full range of addresses provided by the local DHCP server (e.g. Fing on Android) but it's a bit of a chore copying the IP into a browser when it can move about.
The other model I'm contemplating is having the ESP update a remote database (using HTTP POST) with its unique chip ID and local IP. Then a script running on the same server with access to the database would service HTTP requests to the server URL. This is where I get bit hazy, as somehow the request needs to redirect the browser back onto the local network to the stored IP address. I'm sure this is quite possible but it might look a bit ugly (i.e. the browser would first access http://my_cheap_crud_host/mysql_hhtp_ac ... device.php then the URL in the address bar would switch to 192.168.1.69 or whatever). Any thoughts anyone?
https://github.com/ofekp/TinyUPnP
On any issues, please try contacting me or add an issue in the repo.
I do my best to answer and resolve issues.
Ofek.
https://github.com/ofekp