DEVICE BUTTON WITH 4 DIFFERENT ACTIONS
Tasmota Version 8.3.1 button and switch commands.
EDIT May 28 2020 Added to bottom of post:
Sonoff Touch multiple press and group topic
This works 1 short press, 2 short press, 3 short press and long press on tasmota Sonoffs basic button to toggle other MQTT devices. Remote MQTT Controlled devices do not need to be V8.3.1
On a devices that has a button,switch or touch pad.
This is with a tasmota V8.3.1 sonoff basic fixed to a living floor lamp.
I wanted the Sonoff basic button pushed onced to toggle the relay ON\OFF to the lamp.
(NO CHANGE from default)
Now I want to hold the button down for 1.5 seconds to toggle ON\OFF kitchen sink light.
And then push putting twice to toggle ON\OFF kitchen overhead light and so on…
Setup on the device to operate push button.
** BACK UP FIRST **
SetOption can now be shortened to SO in 8.3.1
In tasmota console input:
SetOption1 Set button multipress mode to
0 = allow all button actions (default)
1 = restrict to single to penta press and hold actions (i.e., disable inadvertent reset due to long press)
(optional)for auto discovery if using Home assistant without yaml.
** Check your other settings.**
Use this backlog.
Should look like this:
“SwitchMode1”:“0” or “SwitchMode1”:“OFF”
“SetOption1”:“1” or “SetOption1”:“ON”
“SwitchTopic”:"" or “SwitchTopic”:“0”
“SetOption73”:“0” or “SetOption73”:“OFF”
“ButtonTopic”:"" or “ButtonTopic”:“0”
Set button hold time to 1.5 seconds.
On Lamp tasmota console input
SetOption32 Number of 0.1 seconds to hold button before sending HOLD action message.
1…100 to set button hold time (default = 40). This option also affects the time required to perform a firmware defaults reset (10x HOLD action time)
Then type in the rules:
(you can put all in one rule but I like to be able to shut off and on each rule.)
Find the MQTT topic of the device(s)you wish to remotely toggle.
Can view in tasmota device info.
*Check what the order of
prefix/topic or topic/prefix
In tasmota device info or console
will look like this or reversed
List of button states
- 10=1 short press
- 11=2 short press
- 12=3 short press
- 13=4 short press
- 14=5 short press
- 3=LONG press
Input rules in the tasmota console
each rule is for 3 other devices to toggle from this button.
In console input with your device topic replace device_topic with your prefix/topic order:
Rule1 ON button1#state=3 DO publish cmnd/device1_topic/POWER 2 ENDON
Rule2 ON button1#state=11 DO publish device2_topic/cmnd/POWER 2 ENDON
Rule3 ON button1#state=12 DO publish device3_topic/cmnd/POWER 2 ENDON
Single gang Sonoff Touch
This switch has Capacitive Touch Sensors as the button. Same procedure as the Sonoff basic just a couple of setting changes for the type of button and group topic.
Tasmota settings for the Sonoff Touch. Version 8.3.1
Before you make any changes, ** BACK UP FIRST **
I set my kitchen lights in a group called kitchen
You can set group topic by editing each device you want in that group device using the console
My rules for this switch in my bedroom will toggle my bedroom light one press, Two press toggle master bathroom light and Long press Power OFF ALL my kitchen lights.
Set my hold action time to 1.5 seconds.
Input my two rules.
Set long two press to toggle bathroom.
ON button1#state=11 DO publish my_bathroom/cmnd/POWER 2 ENDON
Set LONG press to do a grouptopic to shut off all kitchens lights.
Rule2 ON button1#state=3 DO publish kitchen/cmnd/POWER 0 ENDON
kitchen is the name of the group for my kitchen lights.