Updated Buttons and Switches (markdown)

blakadder 2019-11-08 20:29:57 +01:00
parent 1fca481087
commit f177f59c9b
1 changed files with 6 additions and 9 deletions

@ -29,10 +29,13 @@ In Tasmota a `Switch` is any switch or push-button additionally connected to a f
- [PIR](https://en.wikipedia.org/wiki/Passive_infrared_sensor) - even though it's technically a sensor it is [configured as a switch in Tasmota](PIR-Motion-Sensors)
- [mechanical push-button](https://en.wikipedia.org/wiki/Push-button)
By default a switch toggles the corresponding relay. Every time the switch gets flipped, the relay changes its state (ON or OFF). Instead of the default toggling of the relay, switches can be configured to send messages to different MQTT topics, or send commands to other Tasmota devices.
By default `Switch<x>` will trigger `Relay<x>`. To ignore this behavior, define a rule which triggers on `Switch#State` or use `[Switchtopic](Commands#Switchtopic)`.
By default a switch toggles the corresponding relay. Every time the switch gets flipped, the relay changes its state (ON or OFF). Instead of the default toggling of the relay, switches can be configured to send messages to different MQTT topics or send commands to other Tasmota devices. To ignore the default behaviour define a rule which triggers on `Switch<x>#State` or use [`Switchtopic`](#Switchtopic).
Example rule to make Switch1 publish its value to cmnd/custom-topic/SWITCH:
```
Rule1 on switch1#state do publish cmnd/custom-topic/SWITCH %value% endon
Rule1 1
```
>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)
@ -106,12 +109,6 @@ When using `SwitchTopic 1` or `2` (or `ButtonTopic 1` or `2`) and your MQTT bro
To avoid this, we recommend using [rules](Rules). They simply always work!
Example:
```
Rule1 on switch1#state do publish cmnd/custom-topic/POWER %value% endon
Rule1 1
```
If you still need to use SwitchTopic or ButtonTopic, read on!
#### `SwitchTopic 0`