Skip to content

Commit 99e3be3

Browse files
Adding the Automation used in the Timers video
1 parent ef0ae1c commit 99e3be3

File tree

5 files changed

+78
-0
lines changed

5 files changed

+78
-0
lines changed

2022-10-AutomatingTimers/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div align="center">
2+
<img src="../images/slacker_labs.png">
3+
<h1>Automating with Timers</h1>
4+
<br>
5+
6+
[![Watch the video](../images/videos/tn-2022-AutomatingTimers2.png)](https://youtu.be/SuLPMxQUv0Q)
7+
8+
</div>
9+
10+
11+
<h2>Files You Need</h2>
12+
13+
**automations.yaml**
14+
15+
Contains the Automation discussed in the video.
16+
17+
18+
19+
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This Automation simply handles turning off a deivce that has been turned on
2+
# by a different method. But you could include a trigger for turning on the device
3+
- id: '1663251471668'
4+
alias: Studio Wax Warmer
5+
description: 'This automation handles the Wax Warmer in the Studio'
6+
trigger:
7+
# Trigger this automation when it the device turns on.
8+
- platform: state
9+
entity_id:
10+
- switch.studio_airfreshener
11+
from: 'off'
12+
to: 'on'
13+
id: wax_on # this is needed for the choose action.
14+
# Trigger when timer finishes. Need to watch for an event.
15+
- platform: event
16+
event_type: timer.finished
17+
event_data:
18+
entity_id: timer.studio_wax_warmer
19+
id: wax_off # this is needed for the choose action.
20+
condition: []
21+
action:
22+
# the choose action allows us to handle our truggers differently.
23+
- choose:
24+
# First, when the device turns on we need to start our timer.
25+
# This timer will run until stopped, so if you have conditions that
26+
# should stop this timer you will need to make sure that are also in the trigger.
27+
# Then just add another condition in this choose action to handle stopping the timer.
28+
- conditions:
29+
- condition: trigger
30+
id: wax_on
31+
sequence:
32+
- service: timer.start
33+
data: {}
34+
target:
35+
entity_id: timer.studio_wax_warmer
36+
# Now we need to handle when the timer has finished. And we just turn off our device.
37+
- conditions:
38+
- condition: trigger
39+
id: wax_off
40+
sequence:
41+
- service: switch.turn_off
42+
data: {}
43+
target:
44+
entity_id: switch.studio_airfreshener
45+
mode: single
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
# Configure a default setup of Home Assistant (frontend, api, etc)
4+
default_config:
5+
6+
automation: !include automations.yaml
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Use this file to store secrets like usernames and passwords.
2+
# Learn more at https://www.home-assistant.io/docs/configuration/secrets/
3+
some_password: welcome
4+
5+
# Update these if you are going to use Amazon Polly config in
6+
# the configuration.yaml
7+
aws_key: fbvekjbvwblv
8+
aws_secret: nfegvwvlwbljew
90.9 KB
Loading

0 commit comments

Comments
 (0)