Skip to content

Instantly share code, notes, and snippets.

@dustinlbarnett
Last active February 9, 2021 06:27
Show Gist options
  • Save dustinlbarnett/204c2f0c416801b22cc83f1e51353b84 to your computer and use it in GitHub Desktop.
Save dustinlbarnett/204c2f0c416801b22cc83f1e51353b84 to your computer and use it in GitHub Desktop.
Light off at sunrise
blueprint:
name: Lights Off At Sunrise
description: Turn off the following lights shortly after sunrise
domain: automation
input:
# Create a variable for identifying the light to act upon
target_light:
name: Lights
description: This is the light (or lights) that will be activated at sunset
# Use a selector, to pick the light(s)
selector:
target:
entity:
domain: light
# Prevent the automation from running concurrently
mode: single
# Define the variables used in the action section
variables:
target_light: !input target_light
# Define the trigger for the automation
trigger:
# Using the state of the sun to act as the trigger
platform: state
entity_id: sun.sun
# We only need to act once the sun drops fully below the horizon, so looking for it to change to this state
to: above_horizon
# This section will take action on the lights, and turn them off
action:
# A very simple structure of turning off the selected light(s)
- service: light.turn_off
target: !input target_light
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment