ESP8266Posted by firstname.lastname@example.org Thu, March 03, 2016 10:09:31
Let's write some code and see if this works out as planned. This blog does not allow me to paste the code here so I have created an attachment containing the code instead.
The code might be a bit confusing since I'm "listening" for an incoming request for 60 seconds and then that just loops over and over again.. which of course makes no sence at all.
The reason is that I'm planning to add a schedule to my lighting. I don't have a problem to to turn on and off lights manually when I'm at home but when I'm not at home I would like the lighting to turn on/off based on a predefined schedule. The ESP8266 will check if the schedule is active every 60 seconds ( but this is not developed yet) . But again how hard can it be :)
There is also a PHP file on my webpage with my floor plan, when clicking a lightbulb we send the HTTP request that the sketch is looking for. Attached you find a basic version of that file. (This basic PHP page does not have to be PHP since it only contains HTML.. but I'm expanding it with additional functionality as well)
I guess that's it.. a webpage to control the power outlets. DONE!
The future plans for this is more functionallity such as;
- Update a mySQL database with the state of all outlets.
- Create schedule to control outlets when not at home
- When ESP updates state based on schedule it should also send a HTTP request back to the webserver to update the database
- Add on additional home automation functionality to the same dashboard.
|Choose site to share content on|