Skip to content

Instantly share code, notes, and snippets.

@kristofer84
Last active January 9, 2022 21:22
Show Gist options
  • Save kristofer84/c0befb0c1fe30adf9e52d950f4643474 to your computer and use it in GitHub Desktop.
Save kristofer84/c0befb0c1fe30adf9e52d950f4643474 to your computer and use it in GitHub Desktop.
blueprint:
name: Generic trigger template (one trigger)
description: Turn one or more devices on/off based on a trigger
domain: automation
input:
trigger_device:
name: Trigger
description: The trigger that will alter the state of the devices.
selector:
entity:
target_device:
name: Devices
description: The devices to keep in sync.
selector:
target:
trigger:
- platform: state
entity_id: !input trigger_device
action:
- service: >
{% if trigger.to_state.state == "on" %}
homeassistant.turn_on
{% else %}
homeassistant.turn_off
{% endif %}
target: !input target_device
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment