-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathEcho-Notification to Close a Window with custom sensors
181 lines (179 loc) · 5.41 KB
/
Echo-Notification to Close a Window with custom sensors
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#
# Home Assistant Automation Blueprint
#
# Sends three notifications to an Amazon Echo device to close a window or door after opening it,
# if the humidity reading (indoor) and temperature reading (outdoor) of the given sensors are below a certain level.
# For this blueprint you need a a working Alexa Media Player Integration, and a humidity sensor that updates its data in short intervalls.
# Most likely it needs a wired power connection for this. A working configuration is the SONOFF TH Sensor Si7021 connected to a Sonoff TH10.
#
# Revision 1.3 (04.01.2022):
# New option to set the volume
# Based on https://github.com/home-IoT/hass-blueprints/blob/main/reminder_to_close_window_with_temp_sensor.yaml
#
blueprint:
name: 'Echo-Notification to Close a Window with custom sensors'
description: Notification by Alexa to close windows if the humidity inside is below a given value. For this blueprint you need a a working Alexa Media Player Integration, and a humidity sensor that updates its data in short intervalls. Most likely it needs a wired power connection for this. A working configuration is the SONOFF TH Sensor Si7021 connected to a Sonoff TH10.
domain: automation
input:
contact_sensor:
name: Contact Sensor
description: 'The window or door sensor that triggers the automation.'
selector:
entity:
domain: binary_sensor
humidity_sensor:
name: Humidity Sensor
description: 'The sensor used for reading the humidity.'
selector:
entity:
domain: sensor
device_class: humidity
humidity:
name: 'Humidity'
description: 'The inside humidity below which the notification should be sent.'
default: 61
selector:
number:
min: 50
step: 1
max: 80
mode: slider
temperature_sensor:
name: Temperature Sensor
description: 'The sensor used for reading the outside temperature.'
selector:
entity:
domain: sensor
device_class: temperature
temperature:
name: 'Temperature'
description: 'The outside temperature below which the notification should be sent.'
default: 20
selector:
number:
min: 0
step: 1
max: 50
mode: slider
first_timer:
name: 'First timer'
description: 'The first notification timer (in minutes). The time starts after opening the window.'
default: 10
selector:
number:
min: 1
step: 1
max: 60
mode: slider
second_timer:
name: 'Second timer'
description: 'The second notification timer (in minutes). The time starts after opening the window.'
default: 15
selector:
number:
min: 1
step: 1
max: 60
mode: slider
third_timer:
name: 'Third timer'
description: 'The third notification timer (in minutes). The time starts after opening the window.'
default: 20
selector:
number:
min: 1
step: 1
max: 60
mode: slider
message:
name: 'Message'
description: 'Change the message Alexa will speak.'
default: Time to close your window.
selector:
text:
multiline: true
echo:
name: 'Echo device'
description: 'Write the device name of the echo you want to use. Something like media_player.echo_bathroom.'
selector:
text:
volume-message:
name: 'Volume of the message'
description: 'Set the volume of the message'
default: 0.6
selector:
number:
min: 0
step: 0.01
max: 1
mode: slider
volume-after:
name: 'Volume after the message'
description: 'The volume your Echo device should use, after the message was spoken'
default: 0.5
selector:
number:
min: 0
step: 0.01
max: 1
mode: slider
# We will have three triggers, for the three different reminders.
# However, a reminder will be ignored if the door or window is already closed by then.
trigger:
- platform: state
entity_id: !input contact_sensor
from: 'off'
to: 'on'
for:
hours: 0
minutes: !input first_timer
seconds: 0
- platform: state
entity_id: !input contact_sensor
from: 'off'
to: 'on'
for:
hours: 0
minutes: !input second_timer
seconds: 0
- platform: state
entity_id: !input contact_sensor
from: 'off'
to: 'on'
for:
hours: 0
minutes: !input third_timer
seconds: 0
# Three conditions:
# 1. The door or window should still be open.
# 2. The inside humidity must be below the set value.
# 3. The outside temperature must be below the set value.
condition:
- condition: state
entity_id: !input contact_sensor
state: 'on'
- condition: numeric_state
entity_id: !input humidity_sensor
below: !input humidity
- condition: numeric_state
entity_id: !input temperature_sensor
below: !input temperature
# Send a notification to the Echo device.
action:
- service: media_player.volume_set
target:
entity_id: !input echo
data:
volume_level: !input volume-message
- service: notify.alexa_media
data:
message: !input message
data:
type: tts
target: !input echo
- service: media_player.volume_set
target:
entity_id: !input echo
data:
volume_level: !input volume-after
mode: single