Skip to content

Instantly share code, notes, and snippets.

@allenporter
Created July 3, 2023 21:05
Show Gist options
  • Save allenporter/e5fabc79be8d42d4cbd4970ba9c6af0c to your computer and use it in GitHub Desktop.
Save allenporter/e5fabc79be8d42d4cbd4970ba9c6af0c to your computer and use it in GitHub Desktop.
Use a calendar to manage an evening light schedule
blueprint:
name: Evening Light Calendar
description: Use a calendar for managing a light schedule. Lights are turned on according the calendar schedule, and only after dark.
domain: automation
input:
calendar_sensor:
name: Calendar Sensor
selector:
entity:
domain:
- calendar
- binary_sensor
target_light:
name: Light
selector:
target:
entity:
domain: light
variables:
cal_switch: !input calendar_sensor
trigger:
- platform: state
entity_id: !input calendar_sensor
- platform: sun
event: sunset
condition:
- after: sunset
condition: sun
action:
service: "{{ iif(is_state(cal_switch, 'on'), 'light.turn_on', '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