Created
May 6, 2021 10:08
-
-
Save H3buss/5d6524283998c238200edc33d4415eda to your computer and use it in GitHub Desktop.
Synchronize 2 switches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Synchronize 2 States | |
description: Bind two switches together to act in unison | |
domain: automation | |
input: | |
switch_1: | |
name: Switch 1 | |
selector: | |
entity: | |
domain: switch | |
switch_2: | |
name: Switch 2 | |
selector: | |
entity: | |
domain: switch | |
variables: | |
switch_1: !input switch_1 | |
switch_2: !input switch_2 | |
trigger: | |
- platform: state | |
entity_id: | |
- !input switch_1 | |
- !input switch_2 | |
mode: single | |
max_exceeded: silent | |
condition: | |
'{{ trigger.to_state.state != trigger.from_state.state }}' | |
action: | |
# Set to target value | |
- choose: | |
- conditions: | |
- '{{ trigger.entity_id != switch_1 }}' | |
- '{{ trigger.to_state.state != states(switch_1) }}' | |
sequence: | |
- service: 'switch.turn_{{ trigger.to_state.state }}' | |
entity_id: !input switch_1 | |
- choose: | |
- conditions: | |
- '{{ trigger.entity_id != switch_2 }}' | |
- '{{ trigger.to_state.state != states(switch_2) }}' | |
sequence: | |
- service: 'switch.turn_{{ trigger.to_state.state }}' | |
entity_id: !input switch_2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment