Skip to content

Instantly share code, notes, and snippets.

@allenporter
Created July 3, 2023 21:07
Show Gist options
  • Save allenporter/f861ac5829061d3d9abf7c30a4d3a4cf to your computer and use it in GitHub Desktop.
Save allenporter/f861ac5829061d3d9abf7c30a4d3a4cf to your computer and use it in GitHub Desktop.
Use a calendar to control when a switch should be turned on/off
blueprint:
name: Switch on Calendar
description: Use a calendar for managing a switch schedule. Switch is turned on according the calendar schedule.
domain: automation
input:
calendar_sensor:
name: Calendar Sensor
selector:
entity:
domain:
- calendar
- binary_sensor
target_switch:
name: Switch
selector:
target:
entity:
domain: switch
variables:
cal_switch: !input calendar_sensor
trigger:
- platform: state
entity_id: !input calendar_sensor
action:
service: "{{ iif(is_state(cal_switch, 'on'), 'switch.turn_on', 'switch.turn_off') }}"
target: !input target_switch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment