A Timer for turning an entity on and off at specific times.
Useful for e.g. Christmas Lights, Night Lights, …
Inputs are
- device_entity
- on_time
- off_time
- (optional) condition
switch-timer.yaml
check github.com for the newest version.
blueprint:
name: Switch Timer
description: Turns a device on at a time and turns it off at a different time.
domain: automation
input:
device_entity:
name: Device to control
description: The entity to turn on and off
selector:
entity:
domain: switch
on_time:
name: Time to turn on
description: The time to turn the device on each day
selector:
time: {}
off_time:
name: Time to turn off
description: The time to turn the device off
selector:
time: {}
condition:
name: Condition
description: An aditional condition to check every run (Can be used to check e.g. the weekday)
selector:
condition: {}
trigger:
- platform: time
at: !input on_time
id: trigger_on
- platform: time
at: !input off_time
id: trigger_off
condition: !input condition
action:
- choose:
- conditions:
- condition: template
value_template: "{{ trigger.id == 'trigger_on' }}"
sequence:
- service: switch.turn_on
target:
entity_id: !input device_entity
- conditions:
- condition: template
value_template: "{{ trigger.id == 'trigger_off' }}"
sequence:
- service: switch.turn_off
target:
entity_id: !input device_entity
mode: single