I always recommend starting with one of the standard protocols (such as X-10) and then BUY the switches/dimmers/outlets even if you want to build the main controller. Plus if you want to add another controlled light or outlet in the future, you just order it and install it and you're done in a couple of days without having to build anything.
There are lots of engineering & construction challenges building a switch that works locally or remotely, fits into an existing outlet box, operates without re-wiring your house, and looks good. And, I doubt you can build it for the cost of buying it.
...I've got a combination X-10/Insteon system with about 10 controlled lights & outlets, a master timer-controller, a few manual remote controllers around the house, and one motion sensor that controls one light. The master timer is programmed from the computer, then it runs stand-alone. My system doesn't have a Wi-Fi or any "permanent" connection to a network, but that could be added if I wanted it.
I didn't build any of it myself, except I built a "sunrise dimmer" and a little "gentle wake-up beeper" that plugs-into a controlled-outlet. The home-automation system just turns it on to start the dim-up sequence 5-days a week so the thing I built doesn't need a real-time clock. (This was built with a different microcontroller a long time ago.)