Updated Buttons and Switches (markdown)

Michael Ingraham 2019-09-05 14:59:10 -04:00
parent 3ae8680130
commit 1c0a28b9ee
1 changed files with 4 additions and 5 deletions

@ -4,8 +4,7 @@ A standard device usually has at least one button (exception being bulbs and som
Additional buttons and switches can be [wired](Expanding-Sonoffs#connect-switch) to a free GPIO and configured in Module or Template settings.
> Tasmota does not publish the state of the switch in any way.
It only sends commands directly to the corresponding relay or to an MQTT topic.
> Tasmota does not automatically publish the state of the switch. It only sends commands directly to the corresponding relay or to an MQTT topic.
## Button vs. Switch
A button (also called a push-button) is a momentary or non-latching switch which causes a temporary change in the state of an electrical circuit only while the switch is pressed. An automatic mechanism (i.e. a spring) returns the switch to its default position immediately afterwards, restoring the initial circuit condition.
@ -40,14 +39,14 @@ By default a switch toggles the corresponding relay. Every time the switch gets
Apart from the default toggling of the relay, switches can be configured to do long press (HOLD) actions, send messages to different MQTT topics or commands to other Tasmota devices.
> Now to make everything a little confusing: A built in push-button can be configured as a Switch and a toggle switch can be configured as a Button. We don't recommend to do so, but it is entirely possible!
>Now, to make everything a little confusing: A push-button can be configured as a `Switch` and a toggle switch can be configured as a `Button`. Configuring a toggle switch as a `Button` is not recommended!
## [SwitchMode](Commands#switchmode)
> For visual learners: [Tasmota Switchmode Explained](https://www.youtube.com/watch?v=kiXAGkyqFeU) - video by Dr Zzs
To change the behavior of an input peripheral configured as a Tasmota `Switch<x>` component, whether a latching switch or a [momentary switch](https://en.wikipedia.org/wiki/Switch#Biased_switches) (i.e., a push-button), use the `SwitchMode` command. If there is more than one `Switch<x>` component, use `SwitchMode<x>` where `<x>` is the number of your switch from GPIO configuration.
To change the behavior of an input peripheral configured as a Tasmota `Switch<x>` component, whether a toggle switch or a [momentary switch](https://en.wikipedia.org/wiki/Switch#Biased_switches) (i.e., a push-button), use the `SwitchMode` command. If there is more than one `Switch<x>` component, use `SwitchMode<x>` where `<x>` is the number of your switch from GPIO configuration.
SwitchMode, as the name implies, applies _**ONLY**_ to GPIO configured in Tasmota as a `Switch<x>` component (9-16 & 82-89). SwitchMode has _**NO**_ impact on the behavior of GPIO configured as `Button<x>` components (17-20, 90-93, & 112-129). SwitchMode is intended to set the desired behavior of a `Switch<x>` component based on whether a switch or a button (a momentary switch) is physically connected to the GPIO.
SwitchMode, as the name implies, applies _**ONLY**_ to GPIO configured in Tasmota as a `Switch<x>` [component](Components) (9-16 & 82-89). SwitchMode has _**NO**_ impact on the behavior of GPIO configured as `Button<x>` [components](Components) (17-20, 90-93, & 112-129). SwitchMode is intended to set the desired behavior of a `Switch<x>` component based on whether a switch or a push-button (i.e., a momentary switch) is physically connected to the GPIO.
**`SwitchMode 0`** (_Tasmota default_)