home-assistant-blueprints/sync_with_entity.yaml

69 lines
1.6 KiB
YAML

blueprint:
name: Sync with Entity
description: Sync entities state with a given entity
domain: automation
source_url: https://git.thethomaas.net/TheThomaas/home-assistant-blueprints/raw/branch/main/sync_with_entity.yaml
input:
reference_entity:
name: Reference entity
description: Entity whose state will be mirored to other entities
default: []
selector:
entity:
filter:
domain:
- input_boolean
multiple: false
target_entities:
name: Target entities
description: Entities whose state will be synced
default: []
selector:
entity:
filter:
domain:
- input_boolean
- switch
- light
multiple: true
mode: restart
max_exceeded: silent
variables:
scene_name: !input scene_name
triggers:
- trigger: state
entity_id: !input reference_entity
from: "off"
to: "on"
id: turn_on
- trigger: state
entity_id: !input reference_entity
from: "on"
to: "off"
id: turn_off
actions:
- choose:
- conditions:
- condition: trigger
id: "turn_on"
sequence:
- action: homeassistant.turn_on
metadata: {}
data: {}
target:
entity_id: !input target_entities
- conditions:
- condition: trigger
id: "turn_off"
sequence:
- action: homeassistant.turn_off
metadata: {}
data: {}
target:
entity_id: !input target_entities