forked from jardiamj/homeassistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
automations.yaml
110 lines (104 loc) · 3.12 KB
/
automations.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
- id: front_door_open
alias: Front Door Open
initial_state: False
hide_entity: False
trigger:
platform: state
entity_id: device_tracker.jardi_phone, device_tracker.juni_phone
from: 'not_home'
to: 'home'
action:
- wait_template: "{{ states('binary_sensor.front_door') == 'on' }}"
timeout: 00:05:00
# - delay: 00:00:01
- service: media_player.turn_on
entity_id: media_player.living_room_speaker
- service: media_player.volume_set
entity_id: media_player.living_room_speaker
data:
volume_level: 0.5
- service: media_player.play_media
entity_id: media_player.living_room_speaker
data:
media_content_id: http://users.du.se/~dbe/mp3/Star%20Wars%20Trilogy%20%28Original%20Motion%20Picture%20Soundtrack%29/Star%20Wars%20Episode%20V%20-%20The%20Empire%20Strikes%20Back/Disc%202/John%20Williams%20-%20S.W.%20Ep.%20V%20-%20CD%202%20-%2001%20-%20The%20Imperial%20March.mp3
media_content_type: 'audio/mp4'
- delay: '00:00:15'
- service: media_player.media_stop
entity_id: media_player.living_room_speaker
# - service: tts.google_say
# entity_id: media_player.living_room_speaker
# data_template:
# message: >
# Welcome home
# {{ trigger.to_state.attributes.friendly_name }}!
- alias: 'Notify if door/window left open'
trigger:
- platform: state
entity_id: group.doors, group.windows
to: 'on'
for:
minutes: 30
action:
- service: notify.jardi_smtp
data_template:
title: 'Home Assistant Message: '
message: >-
{% for entity in trigger.to_state.attributes.entity_id %}
{% if states(entity ) == 'on' %}
{{ state_attr(entity , 'friendly_name') }} has been opened for 30 minutes
{% endif %}
{% endfor %}
- alias: 'Open Front Door - Turn on Light'
trigger:
platform: state
entity_id: binary_sensor.front_door
from: 'off'
to: 'on'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: switch.front_porch
state: 'off'
action:
- service: switch.turn_on
entity_id: switch.front_porch
- delay: '00:05:00'
- service: switch.turn_off
entity_id: switch.front_porch
- alias: 'Arriving Home - Turn on Light'
trigger:
- platform: state
entity_id: group.presence_detection
from: 'not_home'
to: 'home'
condition:
- condition: state
entity_id: sun.sun
state: 'below_horizon'
- condition: state
entity_id: switch.front_porch
state: 'off'
action:
- service: switch.turn_off
entity_id: switch.front_porch
- delay: '00:10:00'
- service: switch.turn_off
entity_id: switch.front_porch
- alias: Front Light On Before Sunset
trigger:
platform: sun
event: sunset
offset: '-00:30:00'
action:
service: switch.turn_on
entity_id: switch.front_porch
- alias: Front Light Off At Sunrise
trigger:
platform: sun
event: sunrise
offset: '+00:00:00'
action:
service: switch.turn_off
entity_id: switch.front_porch