From 2b2f19a8f19e9fc2df148192f46d4f33c16470a9 Mon Sep 17 00:00:00 2001 From: Gerard Date: Wed, 24 Mar 2021 22:58:17 +0100 Subject: [PATCH] Add multiple actions example to switch template (#17122) Add multiple actions example to switch template --- source/_integrations/switch.template.markdown | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/source/_integrations/switch.template.markdown b/source/_integrations/switch.template.markdown index a1925e89a0a..c4e7c6e9841 100644 --- a/source/_integrations/switch.template.markdown +++ b/source/_integrations/switch.template.markdown @@ -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