Using the button - Lehmancreations/Sonoff-With-MQTT GitHub Wiki

In my openHAB setup I have a switch item that is called Sonoff1Button and listens for the MQTT topic that I have set up. In my rules I have a rule set up to run on change of the switch. The rule checks to see if the Sonoff1 switch (my relay item) is on if it is then I switch it off. If it is off I switch it on. Then I send the command to turn off the sonoff1button switch. This allows it to act like a button and not a switch.

I decided to have the button send a MQTT command instead of switching the output so I could use OpenHab and have it do what ever I wanted, and switch on the fly and not have to reflash the Sonoff.