Using Macros in the voice notifications for a little randomness.

This commit is contained in:
CCOSTAN
2017-02-15 02:29:08 +00:00
parent ae5c2e49b0
commit d7b159118e
3 changed files with 22 additions and 3 deletions

View File

@@ -22,5 +22,17 @@
value1: >
{% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
!include voice.macros
{% macro greeting_sentence(person) %}
{{ [
"Welcome home " ~ person,
"Guess who is home? " ~ person +" is!",
"Attention: " ~ person + " is now in the house.",
person ~ " in da house!",
"Welcome Home " ~ person + ". We've missed you. or at least Molly did.",
"Our home is now complete, Rest your head and relax your feet! Welcome Back " ~ person,
"Life is like a song, youre back where you belong. Welcome home" ~ person,
"Hey there " ~ person,
person ~ "! You're home!"
] | random }}
{% endmacro %}
{{greeting_sentence(person)}}

View File

@@ -20,12 +20,19 @@
entity_id:
- light.outdoor_bathroom
- group.living_room_accents
- delay: '00:{{ (range(1, 20)|random|int) }}:00'
#- delay: '00:{{ (range(1, 20)|random|int) }}:00'
- service: script.monthly_color_scene
- service: script.Voice_notify
data_template:
value1: >
!include voice.macros
{% macro dark_outside() %}
{{ [
"It is pretty dark outside. I will turn on the outside lights now.",
"It's a little past Sunset. Time to turn on the outside lights. I'm on it.",
"I'll switch on the outside lights. It's getting dark outside.",
"Time to turn on the front lights. I'll take care of it."
] | random }}
{% endmacro %}
{{ dark_outside() }}
######################################################################