forked from BeardedTinker/Home-Assistant_Config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbriefing.yaml
357 lines (319 loc) · 18.2 KB
/
briefing.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
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
>-
{%- macro dark_outside() -%}
{{ [
'It is pretty dark outside. I will turn on the outside lights now.',
'The sun is offical down. Exterior Cameras are now motion activated.',
'The sun has been ushered off the stage. Activating the perimiter cameras.',
'It is a little past Sunset. Time to turn on the outside lights. I am on it.',
'I will switch on the outside lights. It is getting dark outside.',
'Time to turn on the front lights. I will take care of it.',
'Switching to night mode! ',
'If you have not looked outside lately the light of the day is gone.',
'The outside world has switched to dark mode.'
]|random }}
{%- endmacro -%}
{%- macro responsibilities() -%}
{% if now().strftime('%a') == 'Wed' or now().strftime('%a') == 'Sun' %}
Today is {{ now().strftime('%A') }} and {{ now().strftime('%A') }} is garbage day.
{% endif %}
{% if now().strftime('%a') == 'Wed' %}
Both Recycling and regular Garbage goes out. Please take out all of the garbage cans tonight.
{% endif %}
{% if now().strftime('%j')|int % 2 != 0 %}
Today is Justin's day to do the chores.
{% else %}
Today is Paige's day to do the chores.
{% endif %}
{%- endmacro -%}
{%- macro inside_weather() -%}
Inside the house, it is {{ states.climate.downstairs.attributes['current_temperature'] }} degrees with around {{ states('sensor.downstairs_thermostat_humidity') }} percent humidity.
{%- endmacro -%}
{%- macro outside_weather() -%}
Outside, it is going to be {{ states('sensor.dark_sky_minutely_summary') }}
{%- endmacro -%}
{%- macro lightning() -%}
There have been {{ states('sensor.blitzortung_lightning_counter') }} lightning strikes detected within {{(states('sensor.blitzortung_lightning_distance') | int / 1.69) | round (1, 'floor')}} Miles of our House. Please make sure everyone is inside the house.
{%- endmacro -%}
{%- macro fridge() -%}
The internal temperature of the refrigerator is currently {{ states('sensor.blink_blink1_temperature') }} degrees.
{%- endmacro -%}
{%- macro light_check() -%}
{% if states.group.all_lights.state != 'off' -%}
There are
{% for state in states.light if state.state == 'on' -%}
{%- if loop.last -%}
{{ loop.index }}
{%- endif -%}
{%- endfor %}
lights on right now.
{% set comma = joiner(', ') %}
The
{% for group in states.group|groupby('state') -%}
{%- for entity in group.list if entity.state == 'on'
and entity.name.split(' ')[1]|lower == 'lights'
and entity.name.split(' ')[0]|lower != 'all'
and entity.name.split(' ')[0]|lower != 'interior'
-%}
{{ 'and' if loop.last and not loop.first else comma() }}
{{ entity.name|replace('Lights','')}}
{%- endfor -%}
{%- endfor -%}
lights are on.
{%- endif -%}
{%- endmacro -%}
{%- macro window_check() -%}
{% if states.group.entry_points.state != 'off' -%}
{% set comma = joiner(', ') %}
The
{% for state in states.binary_sensor if state.state == 'on' and state.attributes.device_class == 'opening' -%}
{%- endfor %}
{% for group in states.binary_sensor|groupby('state') -%}
{%- for entity in group.list if entity.state == 'on' and entity.attributes.device_class == 'opening' -%}
{{ ' and' if loop.last and not loop.first else comma() }}
{{ entity.attributes.friendly_name }}
{%- endfor -%}
{% endfor %}
need to be closed.
{%- endif -%}
{%- endmacro -%}
{%- macro lock_check() -%}
{% if states.group.locks.state !='locked' -%}
The
{%- for state in states.lock -%}
{%- endfor %}
{% for group in states.lock|groupby('state') -%}
{%- for entity in group.list if entity.state == 'unlocked' -%}
{{ ' and' if loop.last and not loop.first }}
{{ entity.attributes.friendly_name }}
{%- endfor -%}
{%- endfor %}
needs to be locked.
{%- endif -%}
{%- endmacro -%}
{%- macro garage_check() -%}
{% if states.group.garage_doors.state !='closed' -%}
The
{%- for state in states.cover -%}
{%- endfor %}
{% for group in states.cover|groupby('state') -%}
{%- for entity in group.list if entity.state == 'open' and entity.attributes.device_class == 'garage' -%}
{{ ' and' if loop.last and not loop.first }}
{{ entity.attributes.friendly_name }}
{%- endfor -%}
{%- endfor %}
need to be closed.
{%- endif -%}
{%- endmacro -%}
{%- macro medicine() -%}
{% if is_state('input_boolean.medicine', 'off') -%}
It looks like Carlo has not taken his medicine yet. Please make sure Carlo takes his medicine now.
{% endif -%}
{%- endmacro -%}
{%- macro iss() -%}
{% if is_state('binary_sensor.iss', 'on') -%}
Here is something interesting. The international space station is above us now. There are {{ states.binary_sensor.iss.attributes['number_of_people_in_space'] }} people in space right now.
{% endif -%}
{%- endmacro -%}
{%- macro moon() -%}
{%- if states.sensor.moon.state == 'Full moon' -%}
{{ [
"Check out the full moon tonight!",
"Hey look, There is the full moon. ",
"The moon is huge! And full. ",
"If you want to see the full moon tonight is the night."
] | random }}
{%- endif -%}
{%- endmacro -%}
{%- macro uv() -%}
{% if states.sensor.dark_sky_uv_index.state|int >= 6 and states.sensor.dark_sky_uv_index.state|int <= 7.9 %}
Today's UV index is {{ states.sensor.dark_sky_uv_index.state }}. You should wear sunscreen if going outside.
{% elif states.sensor.dark_sky_uv_index.state|int >= 8 and states.sensor.dark_sky_uv_index.state|int <=10.9 %}
Today's UV index is {{ states.sensor.dark_sky_uv_index.state }}. This is VERY HIGH. Be sure wear sunscreen and re-apply.
{% elif states.sensor.dark_sky_uv_index.state|int >= 11 %}
Today's UV index is {{ states.sensor.dark_sky_uv_index.state }}. This is EXTREME. You should be very cautious going outside.
{% endif %}
{%- endmacro -%}
{%- macro holiday() -%}
{% if states.sensor.holiday.state != '' %}
Today is {{ states.sensor.holiday.state }}.
{% endif %}
{%- endmacro -%}
{# YOUTUBE VIDEO ********* https://www.vcloudinfo.com/2019/11/adding-days-until-sensor-to-my-home-assistant-speech-routines.html #}
{%- macro days_until() -%}
{%- if states('sensor.mothers_countdown') | int < 20 -%}
and don't forget, there is only {{ states.sensor.mothers_countdown.state }} days until Mothers day!
{%- elif states('sensor.fathers_countdown') | int < 20 -%}
and don't forget, there are {{ states.sensor.fathers_countdown.state }} days until Fathers day!
{%- elif states('sensor.easter_countdown') | int < 15 -%}
and don't forget, there are {{ states.sensor.easter_countdown.state }} days until Easter Sunday!
{%- elif states('sensor.thanksgiving_day_countdown') | int < 10 and states('sensor.thanksgiving_day_countdown') | int > 0 -%}
and don't forget, there are {{ states.sensor.thanksgiving_day_countdown.state }} days until Thanksgiving
{%- elif states('sensor.thanksgiving_day_countdown') | int < 1 -%}
and don't forget, Thanksgiving is tomorrow!
{%- elif states('sensor.halloween_countdown') | int < 30 and states('sensor.halloween_countdown') | int > 0 -%}
and don't forget, there are {{ states.sensor.halloween_countdown.state }} Spooky days until Halloween!
{%- elif states('sensor.halloween_countdown') | int < 1 -%}
and don't forget, Tomorrow is Halloween!
{%- elif states('sensor.chanukkah_countdown') | int < 15 -%}
and don't forget, there are {{ states.sensor.chanukkah_countdown.state }} days until Chanukkah!
{%- elif states('sensor.christmas_countdown') | int < 30 and states('sensor.christmas_countdown') | int > 0 -%}
and don't forget, there are {{ states.sensor.christmas_countdown.state }} Merry days until Christmas!
{%- elif states('sensor.christmas_countdown') | int < 1 -%}
and don't forget, Santa Claus is coming tomorrow!
{% endif %}
{%- endmacro -%}
{% macro inspirational_quote() %}
{% set inspirational_quote = [
"and one more thing, Life is about making an impact, make it a positive one. ",
"and one more thing, Whatever the mind of man can conceive and believe, it can achieve. ",
"and one more thing, Strive not to be a success, but rather to be of value. ",
"and one more thing, I attribute my overall success to never giving or taking an excuse. ",
"and one more thing, You miss one hundred percent of the shots you don’t take. ",
"and one more thing, The most difficult thing is the decision to act, the rest is merely tenacity. ",
"and one more thing, The only difference between who you are and who you want to be, is what you do. ",
"and one more thing, Every strike brings me closer to the next home run. ",
"and one more thing, Defining thepurpose is the starting point of all achievement. ",
"and one more thing, Life is not about getting and having, it's about giving and being. ",
"and one more thing, We become what we think about. ",
"and one more thing, Be the change that you wish to see in the world. ",
"and one more thing, A wise man changes his mind but a fool never will. ",
"and one more thing, Change is inevitable. Growth is optional. ",
"and one more thing, dont worry, be happy. ",
"and one more thing, Trust the process. ",
"and one more thing, There are far better things ahead of us than behind us. ",
"and one more thing, If you want to go fast, go alone but if you want to go far, go with others. ",
"and one more thing, The key to success is to focus on goals not obstacles. ",
"and one more thing, Sometimes we are tested not to show our weaknesses, but to discover our strengths. ",
"and one more thing, Do something today that your future self will thank you for. ",
"and one more thing, Life is ten percent what happens to you and ninety percent of how you react to it. ",
"and one more thing, The most common way people give up their power is by thinking they do not have any. ",
"and one more thing, The mind is everything. What you think, you will become. ",
"and one more thing, Always try to Live your best life. ",
"and one more thing, When nothing goes right, go left. ",
"and one more thing, The best time to plant a tree was twenty years ago. The second best time is now. ",
"and one more thing, An unexamined life is not worth living. ",
"and one more thing, Eighty percent of success is showing up. ",
"and one more thing, Do not stop when you are tired, stop when you are done. ",
"and one more thing, Luck is being prepared and ready for the opportunities when they come. ",
"and one more thing, Do not wait for opportunity. Create it.",
"and one more thing, action is the foundation of success. ",
"and one more thing, All progress takes place outside the comfort zone. ",
"and one more thing, You can make mistakes but you should never quit. ",
"and one more thing, Do not let the fear of losing be greater than the excitement of winning. ",
"and one more thing, The way to get started is to quit talking and begin doing. ",
"and one more thing, when you feel like quitting, remember why you started. ",
"and one more thing, The harder you work, the more luck people will think you have. ",
"and one more thing, The harder you work for something, the greater you will feel when you achieve it. ",
"and one more thing, Your time is limited, so do not waste it living someone elses life. ",
"and one more thing, Winning is not everything, but wanting to win is. ",
"and one more thing, I am not a product of my circumstances. I am a product of my decisions. ",
"and one more thing, You can never cross the ocean until you have the courage to lose sight of the shore. ",
"and one more thing, Either you run the day, or the day runs you. ",
"and one more thing, Whether you think you can or you think you cannot, you will be right. ",
"and one more thing, The two most important days in your life are the day you are born and the day you find out why. ",
"and one more thing, Never ruin a good day by thinking about a bad yesterday. ",
"and one more thing, Whatever you can do, or dream you can, begin it. Boldness has genius, power and magic in it. ",
"and one more thing, The best revenge is massive success. ",
"and one more thing, The universe cant put good into your hands unless you let go of the bad.",
"and one more thing, People often say that motivation does not last. Well, neither does bathing. That is why we recommend it daily. ",
"and one more thing, Life shrinks or expands in proportion to ones courage. ",
"and one more thing, If you hear a voice within you say you cannot paint, then by all means paint and that voice will be silenced. ",
"and one more thing, Do not raise your voice, instead improve your argument. ",
"and one more thing, There is only one way to avoid criticism: do nothing, say nothing, and be nothing. ",
"and one more thing, Ask and it will be given to you; search, and you will find; knock and the door will be opened for you. ",
"and one more thing, The only person you are destined to become is the person you decide to be. ",
"and one more thing, Go confidently in the direction of your dreams. Live the life you have imagined. ",
"and one more thing, Certain things catch your eye, but pursue only those that capture the heart. ",
"and one more thing, Believe you can and you are halfway there. ",
"and one more thing, Good things take time. ",
"and one more thing, If you cant beat the Fear... just do it scared! ",
"and one more thing, There is no place like home. ",
"and one more thing, Life can be tough but so are you. ",
"and one more thing, Everything you have ever wanted is on the other side of fear. ",
"and one more thing, Start where you are. Use what you have. Do what you can. ",
"and one more thing, Fall seven times and stand up eight. ",
"and one more thing, Everything has beauty, but not everyone can see. ",
"and one more thing, Life is like riding a bicycle. To keep your balance, you must keep moving. ",
"and one more thing, Life is not measured by the number of breaths we take, but by the moments that take our breath away. ",
"and one more thing, in any given moment, we can choose to move forward and grow or retreat.",
"and one more thing, Happiness is not something readymade. It comes from your own actions. ",
"and one more thing, If you are offered a seat on a rocket ship, do not ask what seat! Just get on. ",
"and one more thing, If the wind will not move you forward, take to the oars. ",
"and one more thing, If you can dream it, you can do it. ",
"and one more thing, You can not fall if you do not climb. But there’s no joy in living your whole life on the ground. ",
"and one more thing, Too many of us are not living our dreams because we are living our fears. ",
"and one more thing, Live your dreams or live your fears. You can only choose one… ",
"and one more thing, Challenges are what make life interesting and overcoming them is what makes life meaningful. ",
"and one more thing, If you want to lift yourself up, lift up someone else. ",
"and one more thing, Be nice to others and nice things will happen to you.",
"and one more thing, It is nice to be important, but more important to be nice."
] %}
{{inspirational_quote|random}}
{% endmacro %}
{# a macro that removes all newline characters, empty spaces, and returns formatted text and replaces underscores with spaces #}
{%- macro cleanup(data) -%}
{%- for item in data.split("\n") if item | trim != "" -%}
{{ item | trim | replace("_", " ") }} {% endfor -%}
{%- endmacro -%}
{# ********************************************* #}
{# ******** Start the Speech routines ******** #}
{# ********************************************* #}
{# a macro to call all macros :) #}
{%- macro mother_of_all_macros() -%}
{% if call_no_announcement != 1 %}
{% if now().strftime('%H')|int < 12 and now().strftime('%H')|int > 6 %}
Good morning.
{% elif now().strftime('%H')|int >= 12 and now().strftime('%H')|int < 17 %}
Good afternoon.
{% else %}
Good evening.
{% endif %}
{% endif %}
{# Called from Annoucenments #}
{{ personarriving | default }}
{# Called from Nest when thermostats turn on #}
{{ NestStatus | default }}
{% if call_inside_weather == 1 %}
{{ inside_weather() }}
{% endif %}
{% if call_outside_weather == 1 and is_state('sun.sun', 'above_horizon') %}
{{ outside_weather() }}
{% endif %}
{% if (states('sensor.blitzortung_lightning_counter')|int) > 0 %}
{{ lightning() }}
{% endif %}
{% if (states('sensor.blink_blink1_temperature')|int) > 50 and no_fridge != 1 %}
{{ fridge() }}
{% endif %}
{{ DoorOpened | default }}
{{ DoorClosed | default }}
{{ lock_check() }}
{# These two lock statements are sent directly from automations. #}
{{ DoorLocked | default }}
{{ DoorUnLocked | default }}
{% if call_dark_outside == 1 %}
{{ dark_outside() }}
{% endif %}
{% if call_garage_check == 1 or is_state('sun.sun', 'below_horizon') %}
{{ garage_check() }}
{% endif %}
{% if (call_window_check == 1 or is_state('sun.sun', 'below_horizon')) or is_state('group.entry_points', 'on') %}
{{ window_check() }}
{% endif %}
{{ NewDevice | default }}
{% if call_light_check == 1 %}
{{ light_check() }}
{% endif %}
{% if call_responsibilities == 1 %}
{{ responsibilities() }}
{% endif %}
{% if now().strftime('%H')|int > 21 %}
{{ medicine() }}
{% endif %}
{% if value1 is not none %}
{{ value1 | default }}
{% endif %}
{# call a Random fact about the house or inspiration quote #}
{{ ([iss, moon, uv, holiday, days_until, outside_weather, outside_weather, inspirational_quote]|random)() }}
{%- endmacro -%}
{{- cleanup(mother_of_all_macros()) -}}