Skip to content

Instantly share code, notes, and snippets.

@haade-administrator
Last active May 31, 2024 09:40
Show Gist options
  • Save haade-administrator/8897d84e11d5e505b729d24a535a89e4 to your computer and use it in GitHub Desktop.
Save haade-administrator/8897d84e11d5e505b729d24a535a89e4 to your computer and use it in GitHub Desktop.
création d'un va et vient dans homeassistant avec 4 interrupteurs
blueprint:
name: Synchronize Four States
description: >
## Bind four entities together to act in unison (selected entites must all support the same state values)
🔥**Version**: v1.0
source_url: https://gist.github.com/haade-administrator/8897d84e11d5e505b729d24a535a89e4
domain: automation
input:
switch_1:
name: Entity 1
selector:
entity:
domain: switch
switch_2:
name: Entity 2
selector:
entity:
domain: switch
switch_3:
name: Entity 3
selector:
entity:
domain: switch
switch_4:
name: Entity 4
selector:
entity:
domain: switch
mode: restart
max_exceeded: silent
variables:
switch_1: !input 'switch_1'
switch_2: !input 'switch_2'
switch_3: !input 'switch_3'
switch_4: !input 'switch_4'
trigger:
- platform: state
entity_id: !input 'switch_1'
- platform: state
entity_id: !input 'switch_2'
- platform: state
entity_id: !input 'switch_3'
- platform: state
entity_id: !input 'switch_4'
action:
- entity_id:
- '{% if trigger.from_state.entity_id == switch_1 %} {{ switch_2 }}'
- '{% if trigger.from_state.entity_id == switch_1 %} {{ switch_3 }}'
- '{% if trigger.from_state.entity_id == switch_1 %} {{ switch_4 }}'
- '{% if trigger.from_state.entity_id == switch_2 %} {{ switch_1 }}'
- '{% if trigger.from_state.entity_id == switch_2 %} {{ switch_3 }}'
- '{% if trigger.from_state.entity_id == switch_2 %} {{ switch_4 }}'
- '{% if trigger.from_state.entity_id == switch_3 %} {{ switch_1 }}'
- '{% if trigger.from_state.entity_id == switch_3 %} {{ switch_2 }}'
- '{% if trigger.from_state.entity_id == switch_3 %} {{ switch_4 }}'
- '{% if trigger.from_state.entity_id == switch_4 %} {{ switch_1 }}'
- '{% if trigger.from_state.entity_id == switch_4 %} {{ switch_2 }}'
- '{% if trigger.from_state.entity_id == switch_4 %} {{ switch_3 }}'
service: homeassistant.turn_{{ trigger.to_state.state }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment