Skip to content

Instantly share code, notes, and snippets.

@hobbe
Last active February 23, 2023 18:50
Show Gist options
  • Save hobbe/cf86b4752c3e38087ad9ff62acae4eda to your computer and use it in GitHub Desktop.
Save hobbe/cf86b4752c3e38087ad9ff62acae4eda to your computer and use it in GitHub Desktop.
Home Assistant blueprint: turn on/off on schedule
blueprint:
name: "[ob] Toggle based on schedule"
description: "Toggle entities (lights or switches) based on schedule's state."
domain: automation
source_url: https://gist.github.com/hobbe/cf86b4752c3e38087ad9ff62acae4eda
homeassistant:
min_version: 2022.10.0
input:
schedule_entity:
name: Schedule
description: "This schedule will toggle the target entities."
selector:
entity:
domain: schedule
target_entity:
name: Target entities
description: "These entities will turn on/off based on the schedule."
selector:
target:
entity:
domain:
- light
- switch
trigger:
- platform: state
entity_id: !input schedule_entity
action:
- service: >
{% if trigger.to_state.state == "on" %}
homeassistant.turn_on
{% else %}
homeassistant.turn_off
{% endif %}
target: !input target_entity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment