1. ESP8266 d1 mini
2. Relay module
3. Normal wall light switch (with should turn the relay and send via mqtt the state of the relay to my hub)
I use mqtt to turn the relay on and off with is working fine, I use it with Home Assistant as hub on a Raspberry pi 3. I want to add a normal wall light switch with function is just turn one of the ESP8266 pins low/high and turn on and off (and change the state of the relay using mqtt) the relay so that I can use my phone as switch and also use the light switch to toggle the relay on and off.
So far the esp8266 can turn the relay on and off (gpio 12, name: relay value: state 1 or state 2) using my phone. This works like a charm but I can't seem to wrote the rules to use the normal light switch to work too.
Code: Select all
On button#state do
if [relay#state]=0
gpio,16,1
publish,%sysname%/relay/gpio
else
gpio,16,0
publish,%sysname%/relay/gpio
endif
endon
Any hints??
Thanks in advance
Javier