-
-
Save Wheemer/fb1a1615056dadadb1d998ebb9bac89d to your computer and use it in GitHub Desktop.
Synchronize States Between Two Fans
This file contains hidden or 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 percentage states | |
| 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: {} | |
| source_url: https://gist.github.com/Wheemer/fb1a1615056dadadb1d998ebb9bac89d | |
| mode: restart | |
| max_exceeded: silent | |
| variables: | |
| entity_1: !input entity_1 | |
| entity_2: !input entity_2 | |
| trigger: | |
| - platform: state | |
| entity_id: !input entity_1 | |
| - platform: state | |
| entity_id: !input entity_1 | |
| attribute: percentage | |
| - platform: state | |
| entity_id: !input entity_2 | |
| - platform: state | |
| entity_id: !input entity_2 | |
| attribute: percentage | |
| condition: [] | |
| action: | |
| - choose: | |
| - conditions: | |
| condition: template | |
| value_template: "{{ is_state(trigger.to_state.entity_id, 'on') }}" | |
| sequence: | |
| - service: fan.turn_on | |
| data: | |
| percentage: '{{ state_attr(trigger.to_state.entity_id, "percentage") }}' | |
| entity_id: '{% if trigger.from_state.entity_id == entity_1 %} {{ entity_2 }} {% else %} {{ entity_1 }} {% endif %}' | |
| default: | |
| - service: fan.turn_off | |
| target: | |
| 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