Add multiple actions example to switch template (#17122)

Add multiple actions example to switch template
This commit is contained in:
Gerard 2021-03-24 22:58:17 +01:00 committed by GitHub
parent a438d968c7
commit 2b2f19a8f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -139,6 +139,38 @@ switch:
{% endraw %}
### Multiple actions for turn_on or turn_off
This example shows multiple service calls for turn_on and turn_off.
{% raw %}
```yaml
switch:
- platform: template
switches:
copy:
value_template: "{{ is_state('switch.source', 'on') }}"
turn_on:
- service: switch.turn_on
target:
entity_id: switch.target
- service: light.turn_on
target:
entity_id: light.target
data:
brightness_pct: 40
turn_off:
- service: switch.turn_off
target:
entity_id: switch.target
- service: light.turn_off
target:
entity_id: light.target
```
{% endraw %}
### Sensor and Two Switches
This example shows a switch that takes its state from a sensor, and uses two