Have one very small issue I just can't seem to work out. I am wondering if I should just be doing this automation in Node-RED, but that seems kind of counter-intuitive when there is a whole rules
The set up is a Sonoff Basic switch, and then the existing light switches wired in to GPIO 14 & 13 (I took the LED off to use the PIN) so people can still use the wall switches.
My rules section currently looks like this (under 'Rules Set 1')
Code: Select all
on ext_sw#Switch do
if [relay#state]=1
event switchoff
else
event switchon
endif
endon
on ext_sw2#Switch do
if [relay#state]=1
event switchoff
else
event switchon
endif
endon
on switchon do
gpio 12,1
endon
on switchoff do
gpio 12,0
endon
This makes sense as the switch state has "changed" so the rule should trigger, but still really annoying. But I am seriously struggling to do this sort of basic logic.
I've tried setting GPIO 12 to low under the hardware section, but it still gets toggled because the switch event runs at boot.
So some more googling, and I find the there is an event called 'System#Boot' & System#Wake you can run rules on. So I've tried simple delay rules, but they don't fix my issue either:
Code: Select all
on System#Wake do
Delay 5000
endon
on System#Boot do
Delay 5000
endon