diff --git a/automation/announcements.yaml b/automation/announcements.yaml index efe3dcf7..378dfd35 100755 --- a/automation/announcements.yaml +++ b/automation/announcements.yaml @@ -37,5 +37,5 @@ action: - service: script.Voice_notify - data_template: - value1: "Attention. {{ trigger.entity_id.split('.')[1].lower().title() }} is now {{ trigger.to_state.state }}" \ No newline at end of file + data_template: + value1: "{{ trigger.entity_id.split('.')[1]|replace('_', ' ') }} is now {{ trigger.to_state.state }}" \ No newline at end of file diff --git a/script/voice_notify.yaml b/script/voice_notify.yaml index 4418fe78..f56c312f 100755 --- a/script/voice_notify.yaml +++ b/script/voice_notify.yaml @@ -40,7 +40,15 @@ voice_notify: - service: tts.google_say entity_id: media_player.whole_house data_template: - message: "{{ value1 }}" + message: > + {% if now().strftime("%H")|int < 12 %} + "Good morning. + {% elif now().strftime("%H")|int < 18 %} + "Good afternoon. + {% else %} + "Good evening. + {% endif %} + {{ value1 }}" cache: true