i want to control my home lights using relays and my phone, but in same time I want to use my wall switches for them. I.e. I want to switch off/on my lights from wall switches and from relays. Obviously if I switch off from the wall switch , the circuit will be open and relay can’t do switch on. So , anybody can give me idea how can I do that ?
The proper way to do it is to have an ESP8266 controlling the relay which switches the light, and connect the present light switch as an input to the ESP8266. The ESP then decides how to interpret the switch position and your phone command.
And this is exactly how it is implemented in the "Sonoff Mini", which is what you need to purchase to do this. It is designed to fir into the light switch enclosure. It makes no sense to attempt to construct it yourself considering the price of the available product. (It is readily hackable! )