Skip to content

Instantly share code, notes, and snippets.

@Blackshome
Last active January 4, 2024 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Blackshome/ec0afd31dce7fc6b106e378d06b01940 to your computer and use it in GitHub Desktop.
Save Blackshome/ec0afd31dce7fc6b106e378d06b01940 to your computer and use it in GitHub Desktop.
timer.yaml
blueprint:
name: Timer
description: >
# ⏲️ Timer
**Version: 1.1**
Let us know what you think of this blueprint and for community support including updates: [Click Here](https://community.home-assistant.io/t/time-clock/651151)
**The Automation Process:**
- Enter in a time you would like to turn ON the entities, then set a duration to turn OFF the entities.
- You have the option to set four time periods.
- You must create a time helper for this automation to run.
Required = *
Need help? See our FAQ: [Click Here](https://community.home-assistant.io/t/time-clock/651151/2)
**If you like my blueprints, and would like to show your support or just say thank you?** [Click Here](https://www.paypal.com/donate/?hosted_button_id=WAZS3QSDTPGA8) 🙂
domain: automation
input:
timer_helper:
name: Timer - Timer Helper *
description: Select the timer helper to be used for all timers.
selector:
entity:
filter:
domain:
- timer
trigger_one_time:
name: Timer 1 - Start Time
description: This is the time to start timer 1.
default: 00:00:00
selector:
time:
trigger_one_duration:
name: Timer 1 - Duration
description: Set the duration for timer 1.
default: 00:00:00
selector:
duration:
entity_input:
name: Entities To Turn ON *
description: The entities that get turned ON by the timers.
selector:
target:
include_extra_triggers:
name: Use The Extra Timers (Optional)
description: Select any additional timers to be used.
default: []
selector:
select:
multiple: true
options:
- label: Use timer two
value: "use_trigger_two"
- label: Use timer three
value: "use_trigger_three"
- label: Use timer four
value: "use_trigger_four"
trigger_two_time:
name: Timer 2 - Start Time
description: This is the time to start timer 2.
default: 00:00:00
selector:
time:
trigger_two_duration:
name: Timer 2 - Duration
description: Set the duration for timer 2.
default: 00:00:00
selector:
duration:
trigger_three_time:
name: Timer 3 - Start Time
description: This is the time to start timer 3.
default: 00:00:00
selector:
time:
trigger_three_duration:
name: Timer 3 - Duration
description: Set the duration for timer 3.
default: 00:00:00
selector:
duration:
trigger_four_time:
name: Timer 4 - Start Time
description: This is the time to start timer 4.
default: 00:00:00
selector:
time:
trigger_four_duration:
name: Timer 4 - Duration
description: Set the duration for timer 4.
default: 00:00:00
selector:
duration:
include_weekdays:
name: Use The Weekdays Option (Optional)
description: This is used for adding a condition to only work on set weekdays. This is a global option for all triggers.
default: weekday_disabled
selector:
select:
options:
- label: Enable the weekday option
value: "weekday_enabled"
- label: Disable the weekday option
value: "weekday_disabled"
weekday_options:
name: Weekdays
description: Select the days of the week you would like the automation to run.
default:
- mon
- tue
- wed
- thu
- fri
- sat
- sun
selector:
select:
multiple: true
mode: list
options:
- label: Monday
value: "mon"
- label: Tuesday
value: "tue"
- label: Wednesday
value: "wed"
- label: Thursday
value: "thu"
- label: Friday
value: "fri"
- label: Saturday
value: "sat"
- label: Sunday
value: "sun"
mode: restart
max_exceeded: silent
variables:
timer_helper: !input timer_helper
trigger_one_time: !input trigger_one_time
trigger_one_duration: !input trigger_one_duration
entity_input: !input entity_input
include_extra_triggers: !input include_extra_triggers
trigger_two_time: !input trigger_two_time
trigger_two_duration: !input trigger_two_duration
trigger_three_time: !input trigger_three_time
trigger_three_duration: !input trigger_three_duration
trigger_four_time: !input trigger_four_time
trigger_four_duration: !input trigger_four_duration
include_weekdays: !input include_weekdays
weekday_options: !input weekday_options
trigger:
- platform: time
at: !input trigger_one_time
id: 't1'
- platform: time
at: !input trigger_two_time
id: 't2'
- platform: time
at: !input trigger_three_time
id: 't3'
- platform: time
at: !input trigger_four_time
id: 't4'
- platform: state
entity_id: !input timer_helper
to: "idle"
id: 't5'
# All Conditions
condition:
#Trigger conditions
- condition: or
conditions:
- condition: and # trigger for ON and OFF state
conditions:
- condition: trigger
id:
- 't1'
- condition: and
conditions:
- condition: trigger
id: 't2'
- "{{ 'use_trigger_two' in include_extra_triggers }}"
- condition: and
conditions:
- condition: trigger
id: 't3'
- "{{ 'use_trigger_three' in include_extra_triggers }}"
- condition: and
conditions:
- condition: trigger
id: 't4'
- "{{ 'use_trigger_four' in include_extra_triggers }}"
- condition: and # trigger for end timer helper
conditions:
- condition: trigger
id: 't5'
# Check The Weekday Option
- condition: or
conditions:
- "{{ include_weekdays == 'weekday_disabled' }}"
- condition: and
conditions:
- condition: time
weekday: !input weekday_options
- "{{ include_weekdays == 'weekday_enabled' }}"
- condition: trigger
id:
- 't5'
action:
- choose:
- alias: "Check if the time helper is enabled"
conditions:
- condition: trigger
id:
- 't1'
- 't2'
- 't3'
- 't4'
sequence:
- alias: "Turn ON the entities"
service: homeassistant.turn_on
target: !input entity_input
- choose:
- alias: "By-pass is turned on & check by-pass option - turn lights off"
conditions:
- condition: trigger
id:
- 't1'
sequence:
- alias: "Turn ON the timer helper"
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_one_duration
- alias: "By-pass is turned on & check by-pass option - turn lights off"
conditions:
- condition: trigger
id:
- 't2'
sequence:
- alias: "Turn ON the timer helper"
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_two_duration
- alias: "By-pass is turned on & check by-pass option - turn lights off"
conditions:
- condition: trigger
id:
- 't3'
sequence:
- alias: "Turn ON the timer helper"
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_three_duration
- alias: "By-pass is turned on & check by-pass option - turn lights off"
conditions:
- condition: trigger
id:
- 't4'
sequence:
- alias: "Turn ON the timer helper"
service: timer.start
entity_id: !input timer_helper
data:
duration: !input trigger_four_duration
- alias: "Turn OFF entities after the timer helper is finished"
conditions:
- condition: trigger
id:
- 't5'
sequence:
- alias: "Turn OFF the entities"
service: homeassistant.turn_off
target: !input entity_input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment