More consolidation for #56

This commit is contained in:
CCOSTAN
2017-04-13 16:03:32 +00:00
parent f0deff928a
commit 83115dde77
3 changed files with 20 additions and 11 deletions

View File

@@ -17,21 +17,25 @@
for: '00:02:00'
action:
- service: input_boolean.turn_on
entity_id:
- input_boolean.responsibilities
- service: script.Voice_notify
data_template:
value1: >
personarriving: >
{% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
{%- macro greeting_sentence(person) -%}
{{ [
"Welcome back home " ~ person,
"Guess who is home? " ~ person +" is!",
"Attention! " ~ person + " is now in the house.",
"Welcome Home " ~ person + ". We've missed you. Or at least Molly did.",
person + " is now in the house.",
"Welcome Home " ~ person + ". We have 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 + " Welcome Home!",
"Knock Knock. Who is There? " ~ person +" is!",
person ~ "! You're home!"
person ~ "! You are home!"
] | random }}
{%- endmacro -%}
"{{greeting_sentence(person)}}"

View File

@@ -15,7 +15,7 @@
- service: script.Voice_notify
data_template:
value1: "The {{ trigger.entity_id.split('.')[1]|replace('_', ' ') }} has been {{ (trigger.to_state.state)|replace('_', ' ') }}."
DoorOpened: "The {{ trigger.entity_id.split('.')[1]|replace('_', ' ') }} has been {{ (trigger.to_state.state)|replace('_', ' ') }}."
- service: script.ifttt_notify
data_template:

View File

@@ -64,11 +64,7 @@ voice_notify:
0.20
{% endif %}
- service: mqtt.publish
data_template:
payload: '{{ value1 }}'
topic: 'polly/lastmsg'
retain: true
- service: tts.amazon_polly_say
entity_id: media_player.livingroomCC
@@ -82,6 +78,8 @@ voice_notify:
"Good evening.
{% endif %}
{{ personarriving }}
{%- macro responsibilities() -%}
{%if now().strftime("%a") == 'Wed' or now().strftime("%a") == 'Sun'%}
Today is {{now().strftime("%A")}} and {{now().strftime("%A")}} is garbage day.
@@ -100,9 +98,16 @@ voice_notify:
{{responsibilities()}}
{%endif%}
{{ DoorOpened }}
{{ value1 }}"
cache: true
- service: mqtt.publish
data_template:
payload: '{{ value1 }}'
topic: 'polly/lastmsg'
retain: true
- service: input_boolean.turn_off
entity_id:
- input_boolean.last_message