Add some more information about buttons and switches.

Federico Leoni 2019-11-09 14:28:10 -03:00
parent 541d611e37
commit d187559370
1 changed files with 7 additions and 3 deletions

@ -58,7 +58,6 @@ Automatic discovery is currently supported for:
- Use Hass [light.switch](https://www.home-assistant.io/components/light.switch/) component - Use Hass [light.switch](https://www.home-assistant.io/components/light.switch/) component
- Sensor - Announced as Home Assistant `sensor` - Sensor - Announced as Home Assistant `sensor`
- Button - Announced as Home Assistant `binary sensor` - Button - Announced as Home Assistant `binary sensor`
- As normal behavior a button will automatically turn off after `one second`
- Switch - Announced as Home Assistant `binary sensor` - Switch - Announced as Home Assistant `binary sensor`
Starting from release 6.7.1 to have `buttons` and `switches` discovered `switchtopic` or `buttontopic` must be set to default value `0` and they will listen to `%topic%/stat/RESULT` topic. Starting from release 6.7.1 to have `buttons` and `switches` discovered `switchtopic` or `buttontopic` must be set to default value `0` and they will listen to `%topic%/stat/RESULT` topic.
@ -67,11 +66,13 @@ MQT: sonoff/stat/RESULT = {"BUTTON1":"TOGGLE"}
MQT: sonoff/stat/RESULT = {"POWER":"ON"} MQT: sonoff/stat/RESULT = {"POWER":"ON"}
MQT: sonoff/stat/POWER = ON MQT: sonoff/stat/POWER = ON
``` ```
This option leave to the user the ability to get a more granular control over entities, for example with a simple rule: This option leave to the user the ability to get a more granular control over entities on both Tasmota or Hass.
A simple Tasmota rule example:
```yaml ```yaml
Rule1 ON Button1#STATE DO Var1 %value% ENDON Rule1 ON Button1#STATE DO Var1 %value% ENDON
``` ```
With the rule enabled , on button press the result will be With the rule enabled , when you press the button you will get
```yaml ```yaml
RUL: BUTTON1#STATE performs "var1 2" RUL: BUTTON1#STATE performs "var1 2"
MQT: sonoff/stat/RESULT = {"Var1":"2"} MQT: sonoff/stat/RESULT = {"Var1":"2"}
@ -79,6 +80,9 @@ MQT: sonoff/stat/RESULT = {"BUTTON1":"TOGGLE"}
``` ```
and the relay will NOT be switched. and the relay will NOT be switched.
Tasmota `switchmode` default for buttons and switches is `Switchmode 0` (TOGGLE). This means all the entities created will automatically turn off after `one second`. To change the button behavior a [switchmode](https://github.com/arendst/Tasmota/wiki/Commands#switchmode) change is needed. For example setting up a switch to `switchmode 1` (follow) will create a switch with ON and OFF payloads.
For other type of devices, e.g iFan02, example entries for configuration.yaml is available in [[Home Assistant - Manual Config|Home-Assistant--Manual-Config]] For other type of devices, e.g iFan02, example entries for configuration.yaml is available in [[Home Assistant - Manual Config|Home-Assistant--Manual-Config]]
On each Tasmota device which should be automatically discovered by Hass, enter the following commands in the web console:\ On each Tasmota device which should be automatically discovered by Hass, enter the following commands in the web console:\