Last active
August 1, 2022 19:58
-
-
Save R3tr0BoiDX/94088fbeb51159622b13613573f11fde to your computer and use it in GitHub Desktop.
Overwrite the on/off state of a given entity with from another
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: | |
description: 'Synchronize the on/off state of 2 entities' | |
domain: automation | |
input: | |
entity_1: | |
name: First entity | |
selector: | |
entity: | |
entity_2: | |
name: Second entity | |
selector: | |
entity: | |
mode: restart | |
max_exceeded: silent | |
variables: | |
entity_1: !input 'entity_1' | |
entity_2: !input 'entity_2' | |
trigger: | |
- platform: state | |
entity_id: !input 'entity_1' | |
condition: | |
- condition: template | |
value_template: '{{ states(entity_1) != states(entity_2) }}' | |
action: | |
- service: homeassistant.turn_{{ trigger.to_state.state }} | |
data: | |
entity_id: '{% if trigger.from_state.entity_id == entity_1 %} {{ entity_2 }} {% else %} {{ entity_1 }} {% endif %}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment