Back to this new ESP Gadget !
My first project with this, is to bring wifi to this :
Goal is :
- Drive this light via is own on/off switch
- Drive this light via Sonoff relay
- Get Switch Statut
Drive the light via Sonoff relay is ok :
Code: Select all
http://<ESP IP address>/control?cmd=GPIO,<pin>,0
http://<ESP IP address>/control?cmd=GPIO,<pin>,1
Getting switch status is ok by using serial gpio.
Now, i need to drive the physical relay by the physical switch like the sonoff module do as original (without going to my home automation and come back to the light) some thing like a rules :
If switch gpio change to 1 and gpio 12 = 0 then gpio 12 = 1
if switch gpio change to 0 and gpio 12 = 1 then gpio 12 = 0
If switch gpio change to 1 and gpio 12 = 1 then gpio 12 = 0
If switch gpio change to 0 and gpio 12 = 0 then gpio 12 = 1
Did you have any tricks please ?