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
!!! WORKS!!!
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:
SO1 1
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)
Next
(optional)for auto discovery if using Home assistant without yaml.
SO19 1
** Check your other settings.**
Use this backlog.
Backlog SwitchMode1;SwitchTopic1;SetOption73;ButtonTopic1
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â
Second step:
Set button hold time to 1.5 seconds.
On Lamp tasmota console input
SetOption32 15
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
by typing
Fulltopic
will look like this or reversed
âFullTopicâ:"%prefix%/%topic%/"
kids_bedroom_light/cmnd/
or
cmnd/kids_bedroom_light/
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
Then type:
Rule1 on
Rule2
ON button1#state=11 DO publish device2_topic/cmnd/POWER 2 ENDON
Then type:
Rule2 on
Then type:
Rule3
ON button1#state=12 DO publish device3_topic/cmnd/POWER 2 ENDON
*Then type:
Rule3 on
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 **
SwitchMode1 0
SwitchTopic 0
SetOption73 OFF
ButtonTopic 0
SetOption1 ON
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
grouptopic1 kitchen
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.
SetOption32 15
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.
Enjoy,
diyredneck.thestovedoc.com