From d7b159118e8b7834fca736b79dc009035506e111 Mon Sep 17 00:00:00 2001 From: CCOSTAN Date: Wed, 15 Feb 2017 02:29:08 +0000 Subject: [PATCH] Using Macros in the voice notifications for a little randomness. --- automation/Speech/announcements.yaml | 14 +++++++++++++- automation/sunrise_turnon_and_off.yaml | 11 +++++++++-- automation/{Speech => }/voice.macros | 0 3 files changed, 22 insertions(+), 3 deletions(-) rename automation/{Speech => }/voice.macros (100%) diff --git a/automation/Speech/announcements.yaml b/automation/Speech/announcements.yaml index 0e35dbef..681d1521 100755 --- a/automation/Speech/announcements.yaml +++ b/automation/Speech/announcements.yaml @@ -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, you’re back where you belong. Welcome home" ~ person, + "Hey there " ~ person, + person ~ "! You're home!" + ] | random }} + {% endmacro %} {{greeting_sentence(person)}} \ No newline at end of file diff --git a/automation/sunrise_turnon_and_off.yaml b/automation/sunrise_turnon_and_off.yaml index c42cc0be..66cf5fed 100755 --- a/automation/sunrise_turnon_and_off.yaml +++ b/automation/sunrise_turnon_and_off.yaml @@ -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() }} ###################################################################### diff --git a/automation/Speech/voice.macros b/automation/voice.macros similarity index 100% rename from automation/Speech/voice.macros rename to automation/voice.macros