It’s really hard to overstate how awesome ESP8266 development boards like the Wemos D1 Mini really are. For literally a couple of dollars you can get a decently powerful Wi-Fi enabled microcontroller ...
Before we begin, we must begin with an obligatory disclaimer: handling mains voltage can be very dangerous. Do not do so unless you are qualified! You could burn your house down. (Without the lemons.) ...