forlotto wrote:It would be great to see some examples of people with servers that can control all of their esp's from the outside world using their server.
That is what I have in mind and hope to have it working by mid-June. Some of it is done already but not tested. I use php and mysql a lot and I might be able to post a simplified version that people can adapt to their general use.
forlotto wrote:I have a bit of trouble comprehending the operation of requests remotely.
There are many ways of doing this. For a sensor to initiate a report is a simple wget() matter. Alternatively you can use one ESP as a clearing house for all ESPs on the subnet and it does Wget() reporting or perhaps uses web sockets. However, controlling the ESP remotely from the web is a different matter with different possibilities.
1. You could set up port forwarding on the router to send requests to the correct ESP based on port number. One problem with this port blocking by some ISPs.
2. You could port forward to just 1 ESP which relays commands via messages to the proper recipients, but there is a loss of speed. An advantage to this is that you can put more of the brains in that host ESP, having it handle decisions about alerts, etc.
3. I like the idea of using web sockets, but I don't yet know if there's a way to open a socket between 2 ESPs instead of 1 ESP and a browser. If this can be done, it opens astounding possibilities!
4. Where speed is not important, you could plant instructions on the server that nodes call in to when reporting. A reporting ESP simply passes an ID with its payload and receives any instructions in its "mailbox". This would be suitable for situations like AC, furnace, and water heater control when you are away from the house and polling every few minutes is an option.
There is the issue of static verses dynamic IP addresses with your ISP. If you have a static IP, no problem. If not, you could have the php script on your server receiving updates just read the IP address of your router and have the facility to report it.
One must decide where the brains of the operation will be. Will one ESP be the broker, handling traffic and making decisions? Will a server host a web site that offers all functionality? Will there be a more direct connection between ESPs on a subnet and a remote browser? There are pros and cons each way and it really does depend on what you want to do.
I'm setting up a system to remotely monitor a house and control some devices. I'll have each ESP report to a server which uses php and mysql to log the data and read the router IP address. The same server will serve up a web page accessible to a remote browser, showing sensor data, history, and a control panel for remote devices. AJAX calls (with the router IP implanted by the web server) will provide calls through the router to the ESP devices. The same server will be able to send alerts via e-mail or text if something is awry at the house.