@Rod_Poplarchick wrote:
DEVICE BUTTON WITH 4 DIFFERENT ACTIONS
Tasmota Version 8.3.1 button and switch commands.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**
In tasmota console input:
SO1 1SetOption1 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;ButtonTopic1Should 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 15SetOption32 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 ENDONThen type:
Rule1 onRule2 ON button1#state=11 DO publish device2_topic/cmnd/POWER 2 ENDONThen type:
Rule2 onThen type:
Rule3 ON button1#state=12 DO publish device3_topic/cmnd/POWER 2 ENDON*Then type:
Rule3 onSoon I will add how use Group topics to shut off several devices at once with button presses.
Enjoy,
diyredneck.thestovedoc.com
Posts: 1
Participants: 1

**
