Smart Switch Multi Press
From KlavoWiki
Enable Multi Press
To enable the multi press feature on the TASMOTA firmware.
backlog SetOption73 1; SetOption32 10
- Setoption32 : Number of 0.1 seconds to hold button before sending HOLD action message. Value 10 equals 1 second. This option also affects the time required to perform a firmware defaults reset (10x HOLD action time)
- SetOption73 : Detach buttons from relays and send multi-press and hold MQTT messages instead.
Example message:
- {"Button1":{"Action":"SINGLE"}}
- {"Button1":{"Action":"DOUBLE"}}
- {"Button1":{"Action":"TRIPPLE"}}
- {"Button1":{"Action":"QUAD"}}
- {"Button1":{"Action":"PENTA"}}
- {"Button1":{"Action":"HOLD"}}
Node-Red Button Control
As the physical button(s) are now no longer attached to the relay I use Node-RED to control each action.
MQTT
Subscribe to the appropriate Topic on the Broker.
json to javascript
Convert the retrieved data from json to JavaScript.
Data
Now that you have converted the data from JSON to JavaScript retrieve the button action.
If you have more than a one button switch make sure to chage the Button1 to the appropriate ButtonX.
Switch
Create as many switch options as necessary.
Action
Finally change the entity to what you want. On, Off, Toggle or if it's LEDs change colour and brightness to predefined colours or whatever else you may want to do.