Skip to content

Instantly share code, notes, and snippets.

@dougrathbone
Last active July 17, 2022 10:57
Show Gist options
  • Save dougrathbone/330c701e065afedb26b6f7cc8776f84b to your computer and use it in GitHub Desktop.
Save dougrathbone/330c701e065afedb26b6f7cc8776f84b to your computer and use it in GitHub Desktop.
blueprint:
name: Timed Switch Control
description: Control your switches between certain times
domain: automation
input:
switch_device:
name: Switch device
description: The switch device to use.
selector:
entity:
domain: light
time_after:
name: Time After
description: After this time the switch turns on, so it's warm in the morning
default: '07:30:00'
selector:
time:
time_before:
name: Time Before
description: After this time the switch turns off, this to prevent the heating is on in the middle of the night
default: '21:30:00'
selector:
time:
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: time_pattern
minutes: /10
action:
- choose:
- conditions:
- condition: time
before: !input 'time_before'
after: !input 'time_after'
sequence:
- service: light.turn_on
data:
entity_id: !input 'switch_device'
default:
- service: light.turn_off
data:
entity_id: !input 'switch_device'
mode: single
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment