Skip to content

Instantly share code, notes, and snippets.

@adwuk
Created October 20, 2022 14:48
Show Gist options
  • Save adwuk/933a3f60aa77838e80e28d9e837ff22f to your computer and use it in GitHub Desktop.
Save adwuk/933a3f60aa77838e80e28d9e837ff22f to your computer and use it in GitHub Desktop.
Home assistant blueprint: Sync the states of two groups of entities so that Group 1 != Group 2
blueprint:
name: Entity State Not
description: Sync the states of two groups of entities so that Group 1 != Group 2
domain: automation
input:
group1:
name: Entity Group 1
selector:
entity:
multiple: true
group2:
name: Entity Group 2
selector:
entity:
multiple: true
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: !input group1
to: 'on'
id: group1_on
- platform: state
entity_id: !input group1
to: 'off'
id: group1_off
- platform: state
entity_id: !input group2
to: 'on'
id: group2_on
- platform: state
entity_id: !input group2
to: 'off'
id: group2_off
action:
- choose:
- conditions:
- condition: trigger
id:
- group1_on
- group2_off
sequence:
- service: homeassistant.turn_on
target:
entity_id: !input group1
- service: homeassistant.turn_off
target:
entity_id: !input group2
- conditions:
- condition: trigger
id:
- group2_on
- group1_off
sequence:
- service: homeassistant.turn_on
target:
entity_id: !input group2
- service: homeassistant.turn_off
target:
entity_id: !input group1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment