Sonoff Enable button after flashing v 148

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
PizzaChip
Normal user
Posts: 11
Joined: 24 Apr 2017, 18:19

Sonoff Enable button after flashing v 148

#1 Post by PizzaChip » 24 Apr 2017, 18:24

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

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Sonoff Enable button after flashing v 148

#2 Post by grovkillen » 24 Apr 2017, 22:20

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
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

PizzaChip
Normal user
Posts: 11
Joined: 24 Apr 2017, 18:19

Re: Sonoff Enable button after flashing v 148

#3 Post by PizzaChip » 26 Apr 2017, 19:54

That made it, thanks!!!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 1 guest