Skip to content

Instantly share code, notes, and snippets.

@jswetzen
Last active January 3, 2022 11:33
Show Gist options
  • Save jswetzen/0cd570fa043320fd79fc5503bc63e1a4 to your computer and use it in GitHub Desktop.
Save jswetzen/0cd570fa043320fd79fc5503bc63e1a4 to your computer and use it in GitHub Desktop.
Home assistant switch based on binary sensor
blueprint:
name: Control with sensor
description: 'Set the state based on a binary sensor'
domain: automation
input:
controller:
name: First entity
selector:
entity:
controllee:
name: Second entity
selector:
entity:
mode: restart
max_exceeded: silent
variables:
controller: !input 'controller'
controllee: !input 'controllee'
trigger:
- platform: state
entity_id: !input 'controller'
action:
- service: homeassistant.turn_{{ trigger.to_state.state }}
data:
entity_id: '{{ controllee }}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment