diff --git a/automation/Speech/announcements.yaml b/automation/Speech/announcements.yaml index 9422186c..90282805 100755 --- a/automation/Speech/announcements.yaml +++ b/automation/Speech/announcements.yaml @@ -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, you’re 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)}}" diff --git a/automation/Speech/door_opened.yaml b/automation/Speech/door_opened.yaml index 416917ed..d8eb0c83 100755 --- a/automation/Speech/door_opened.yaml +++ b/automation/Speech/door_opened.yaml @@ -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: diff --git a/script/voice_notify.yaml b/script/voice_notify.yaml index 862fc987..41ebfe55 100755 --- a/script/voice_notify.yaml +++ b/script/voice_notify.yaml @@ -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. @@ -99,10 +97,17 @@ voice_notify: {% if is_state('input_boolean.responsibilities', 'on') %} {{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