I used a breakout board which comes with No firmware in it and it required lot of work in it, uploading a firmware is really daunting task. To eliminate such conditions you can directly buy this module from seeed studio, NodeMCU v2 - Lua based ESP8266 development kit which already comes with pre-loaded lua firmware
This program connected to the wifi home server that is specified by the user, Once it connected to the homeserver, you can check the IP address assigned to the esp8266 by logging into your WIFI modem and check for the DHCP Clients List. Open a broswer and type in the IP address that your esp8266 has associated with, you will see the webpage returned by the module and wait for the command from the user.
1) Download ESPlorer here
2) Connect Nodemcu development kit
Choose correct COM part that your esp8266 has connected and click the Open.
3) Copy paste the program and make sure the program named as init.lua and change the Name and Password to match your Home server.
Once the program is successfully uploaded , you will be returned with the IP address assigned to your esp8266 device in the ESPlorer window. Or you can log into your Home connection and check the list of devices connected to it.
I used IO index 5,6,7,8 which corresponding GPIO pins are GPIO14, GPIO12, GPIO13, GPIO15, Make sure you are choosing the right index and choosing correct GPIO for connecting to the relay module.
Detailed Video If you are using other esp8266 breakout boards