Skip to content

Instantly share code, notes, and snippets.

@allistera
Last active January 15, 2023 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allistera/50dcc34066b8f2841b1fdca29d9a95d5 to your computer and use it in GitHub Desktop.
Save allistera/50dcc34066b8f2841b1fdca29d9a95d5 to your computer and use it in GitHub Desktop.
blueprint:
name: Switch-activated Light
description: Turn on a light on/off following a switch.
domain: automation
input:
switch_entity:
name: Switch
selector:
entity:
light_target:
name: Light
selector:
target:
entity:
domain: light
mode: restart
max_exceeded: silent
condition:
- condition: template
value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'
trigger:
platform: state
entity_id: !input switch_entity
action:
- alias: "Turn on/off the light"
service: "light.turn_{{ trigger.to_state.state }}"
target: !input light_target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment