Skip to content

Instantly share code, notes, and snippets.

@kristofer84
Last active January 9, 2022 21:19
Show Gist options
  • Save kristofer84/c10808f4fc049e1b6deabfb33bdc22f5 to your computer and use it in GitHub Desktop.
Save kristofer84/c10808f4fc049e1b6deabfb33bdc22f5 to your computer and use it in GitHub Desktop.
blueprint:
name: Generic trigger template (two triggers)
description: Turn one or more devices on/off based on a trigger
domain: automation
input:
trigger_device:
name: First trigger
description: Either trigger will alter the state of the devices.
selector:
entity:
trigger_device2:
name: Second trigger
selector:
entity:
target_device:
name: Devices
description: The devices to keep in sync.
selector:
target:
trigger:
- platform: state
entity_id: !input trigger_device
- platform: state
entity_id: !input trigger_device2
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