Files
blueprints/state-opposite.yaml
2025-07-04 20:16:15 +00:00

76 lines
1.8 KiB
YAML

blueprint:
name: Opposite State Synchronizer
description: >
Keeps two entities in opposite states. If entity 1 turns on, entity 2 turns off, and vice versa.
domain: automation
input:
entity_1:
name: Entity 1
selector:
entity:
domain:
- light
- switch
entity_2:
name: Entity 2
selector:
entity:
domain:
- light
- switch
trigger:
- platform: state
entity_id: !input entity_1
id: entity_1
- platform: state
entity_id: !input entity_2
id: entity_2
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: entity_1
- condition: state
entity_id: !input entity_1
state: "on"
sequence:
- service: homeassistant.turn_off
target:
entity_id: !input entity_2
- conditions:
- condition: trigger
id: entity_1
- condition: state
entity_id: !input entity_1
state: "off"
sequence:
- service: homeassistant.turn_on
target:
entity_id: !input entity_2
- conditions:
- condition: trigger
id: entity_2
- condition: state
entity_id: !input entity_2
state: "on"
sequence:
- service: homeassistant.turn_off
target:
entity_id: !input entity_1
- conditions:
- condition: trigger
id: entity_2
- condition: state
entity_id: !input entity_2
state: "off"
sequence:
- service: homeassistant.turn_on
target:
entity_id: !input entity_1
mode: single