Page 1 of 1

Sonoff Enable button after flashing v 148

Posted: 24 Apr 2017, 18:24
by PizzaChip
Hello I flashed ESPEasy v 148 onto Sonoff plugs and I am able to control them via OpenHab2/MQTT; however I would like to be able to manually switch on/off by pressing the little button on the plug; is it possible? If yes, how?

Hereafter my devices config:
Image

These are my rules:

on lightSwitch#Switch do
if [lightState#Switch]=0
gpio,12,0
else
gpio,12,1
endif
endon

Re: Sonoff Enable button after flashing v 148

Posted: 24 Apr 2017, 22:20
by grovkillen
This is my rule. As you see you only want to check the button state since it will control the relay state. Your rule will never change the relay since the "if" will always see that the relay state is 0. So change if [lightState#Switch]=0 to if [lightSwitch#Switch]=0

Code: Select all

on Button#State do
if [Button#State]=0
  Publish %sysname%/status,Manual turn off relay
  gpio,12,0
  gpio,13,1
else
  Publish %sysname%/status,Manual turn on relay
  gpio,12,1
  gpio,13,0
endif
endon

Re: Sonoff Enable button after flashing v 148

Posted: 26 Apr 2017, 19:54
by PizzaChip
That made it, thanks!!!