Skip to content

Instantly share code, notes, and snippets.

@niro1987
Last active January 15, 2022 09:02
Show Gist options
  • Save niro1987/617a78566d522588037deb4ac37bb8e1 to your computer and use it in GitHub Desktop.
Save niro1987/617a78566d522588037deb4ac37bb8e1 to your computer and use it in GitHub Desktop.
Home Assistant - Blueprint - Sync a light with a binary sensor
---
# This automation takes a binary_sensor and sets the light to the sames state.
blueprint:
source_url: https://github.com/niro1987/homeassistant-config/blob/main/blueprints/automation/niro1987/binary_sensor_sync_light.yaml
name: Sync a light with a binary sensor
description: >-
This automation keeps a light in sync with a binary sensor.
domain: automation
input:
switch_entity:
name: Binary Sensor
description: The binary_sensor to sync the light with.
selector:
entity:
domain: binary_sensor
default: binary_sensor.living_room
light_entity:
name: Light
description: The light to keep in sync.
selector:
entity:
domain: light
default: light.living_room
mode: single
max_exceeded: silent
trigger:
- platform: state
entity_id: !input switch_entity
from:
- "on"
- "off"
to:
- "off"
- "on"
action:
- choose:
- conditions:
- condition: state
entity_id: !input switch_entity
state: "on"
sequence:
- service: light.turn_on
data:
entity_id: !input light_entity
default:
- service: light.turn_off
data:
entity_id: !input light_entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment