Skip to content

Instantly share code, notes, and snippets.

@haade-administrator
Last active February 27, 2023 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haade-administrator/f551382802c642d24687bfbcd303f0fe to your computer and use it in GitHub Desktop.
Save haade-administrator/f551382802c642d24687bfbcd303f0fe to your computer and use it in GitHub Desktop.
création d'un va et vient dans homeassistant avec 3 interrupteurs
blueprint:
name: Synchronize 3 Way simulate
description: Bind Three 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
switch_3:
name: Switch 3
selector:
entity:
domain: switch
variables:
switch_1: !input switch_1
switch_2: !input switch_2
switch_3: !input switch_3
trigger:
- platform: state
entity_id:
- !input switch_1
- !input switch_2
- !input switch_3
mode: single
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
- choose:
- conditions:
- '{{ trigger.entity_id != switch_3 }}'
- '{{ trigger.to_state.state != states(switch_3) }}'
sequence:
- service: 'switch.turn_{{ trigger.to_state.state }}'
entity_id: !input switch_3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment