From 0de8599429d27e35d67e41af5062373233b3d9e6 Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sun, 1 Jan 2023 12:39:51 -0500 Subject: [PATCH] Briefings now read out yesterday's game results as well --- templates/speech/daily_briefing.yaml | 68 ++++++++++++++++ templates/speech/morning_briefing.yaml | 105 +++++++++++++++++++++++++ templates/speech/nightly_briefing.yaml | 68 ++++++++++++++++ 3 files changed, 241 insertions(+) diff --git a/templates/speech/daily_briefing.yaml b/templates/speech/daily_briefing.yaml index fba5302..7498184 100644 --- a/templates/speech/daily_briefing.yaml +++ b/templates/speech/daily_briefing.yaml @@ -440,6 +440,7 @@

{% if is_state('sensor.michigan_wolverines','POST') %} {% set date = state_attr('sensor.michigan_wolverines','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.michigan_wolverines','team_score') | int) > (state_attr('sensor.michigan_wolverines','opponent_score') | int) %} "The Michigan Wolverines won their game today against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','team_score') }} to {{ state_attr('sensor.michigan_wolverines','opponent_score') }}. " @@ -447,6 +448,13 @@ "The Michigan Wolverines lost their game today against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','opponent_score') }} to {{ state_attr('sensor.michigan_wolverines','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.michigan_wolverines','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.michigan_wolverines','team_score') | int) > (state_attr('sensor.michigan_wolverines','opponent_score') | int) %} + "The Michigan Wolverines won their game yesterday against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','team_score') }} to {{ state_attr('sensor.michigan_wolverines','opponent_score') }}. " + {% else %} + "The Michigan Wolverines lost their game yesterday against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','opponent_score') }} to {{ state_attr('sensor.michigan_wolverines','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.michigan_wolverines','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.michigan_wolverines','IN') %} {% if (state_attr('sensor.michigan_wolverines','team_score') | int) > (state_attr('sensor.michigan_wolverines','opponent_score') | int) %} @@ -460,6 +468,7 @@ {% if is_state('sensor.ohio_state_buckeyes','POST') %} {% if state_attr('sensor.ohio_state_buckeyes','opponent_abbr') not in ['MICH'] %} {% set date = state_attr('sensor.ohio_state_buckeyes','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.ohio_state_buckeyes','team_score') | int) > (state_attr('sensor.ohio_state_buckeyes','opponent_score') | int) %} "The Ohio State Buckeyes won their game today against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','team_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }}. " @@ -467,6 +476,13 @@ "The Ohio State Buckeyes lost their game today against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.ohio_state_buckeyes','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.ohio_state_buckeyes','team_score') | int) > (state_attr('sensor.ohio_state_buckeyes','opponent_score') | int) %} + "The Ohio State Buckeyes won their game yesterday against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','team_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }}. " + {% else %} + "The Ohio State Buckeyes lost their game yesterday against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.ohio_state_buckeyes','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% endif %} {% elif is_state('sensor.ohio_state_buckeyes','IN') %} @@ -482,6 +498,7 @@ {% endif %} {% if is_state('sensor.toledo_rockets','POST') %} {% set date = state_attr('sensor.toledo_rockets','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %} "The Toledo Rockets won their game today against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','team_score') }} to {{ state_attr('sensor.toledo_rockets','opponent_score') }}. " @@ -489,6 +506,13 @@ "The Toledo Rockets lost their game today against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','opponent_score') }} to {{ state_attr('sensor.toledo_rockets','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.toledo_rockets','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %} + "The Toledo Rockets won their game yesterday against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','team_score') }} to {{ state_attr('sensor.toledo_rockets','opponent_score') }}. " + {% else %} + "The Toledo Rockets lost their game yesterday against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','opponent_score') }} to {{ state_attr('sensor.toledo_rockets','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.toledo_rockets','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.toledo_rockets','IN') %} {% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %} @@ -501,6 +525,7 @@ {% endif %} {% if is_state('sensor.minnesota_vikings','POST') %} {% set date = state_attr('sensor.minnesota_vikings','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.minnesota_vikings','team_score') | int) > (state_attr('sensor.minnesota_vikings','opponent_score') | int) %} "The Minnesota Vikings won their game today against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " @@ -510,6 +535,15 @@ "The Minnesota Vikings lost their game today against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','opponent_score') }} to {{ state_attr('sensor.minnesota_vikings','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.minnesota_vikings','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.minnesota_vikings','team_score') | int) > (state_attr('sensor.minnesota_vikings','opponent_score') | int) %} + "The Minnesota Vikings won their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " + {% elif (state_attr('sensor.minnesota_vikings','team_score') | int) == state_attr('sensor.minnesota_vikings','opponent_score') | int %} + "The Minnesota Vikings tied in their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " + {% else %} + "The Minnesota Vikings lost their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','opponent_score') }} to {{ state_attr('sensor.minnesota_vikings','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.minnesota_vikings','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.minnesota_vikings','IN') %} {% if (state_attr('sensor.minnesota_vikings','team_score') | int) > (state_attr('sensor.minnesota_vikings','opponent_score') | int) %} @@ -522,6 +556,7 @@ {% endif %} {% if is_state('sensor.san_francisco_49ers','POST') %} {% set date = state_attr('sensor.san_francisco_49ers','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %} "The San Francisco 49ers won their game today against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " @@ -531,6 +566,15 @@ "The San Francisco 49ers lost their game today against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','opponent_score') }} to {{ state_attr('sensor.san_francisco_49ers','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.san_francisco_49ers','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %} + "The San Francisco 49ers won their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " + {% elif (state_attr('sensor.san_francisco_49ers','team_score') | int) == state_attr('sensor.san_francisco_49ers','opponent_score') | int %} + "The San Francisco 49ers tied in their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " + {% else %} + "The San Francisco 49ers lost their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','opponent_score') }} to {{ state_attr('sensor.san_francisco_49ers','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.san_francisco_49ers','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.san_francisco_49ers','IN') %} {% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %} @@ -543,6 +587,7 @@ {% endif %} {% if is_state('sensor.cleveland_guardians','POST') %} {% set date = state_attr('sensor.cleveland_guardians','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.cleveland_guardians','team_score') | int) > (state_attr('sensor.cleveland_guardians','opponent_score') | int) %} "The Cleveland Guardians won their game today against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','team_score') }} to {{ state_attr('sensor.cleveland_guardians','opponent_score') }}. " @@ -550,6 +595,13 @@ "The Cleveland Guardians lost their game today against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','opponent_score') }} to {{ state_attr('sensor.cleveland_guardians','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.cleveland_guardians','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.cleveland_guardians','team_score') | int) > (state_attr('sensor.cleveland_guardians','opponent_score') | int) %} + "The Cleveland Guardians won their game yesterday against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','team_score') }} to {{ state_attr('sensor.cleveland_guardians','opponent_score') }}. " + {% else %} + "The Cleveland Guardians lost their game yesterday against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','opponent_score') }} to {{ state_attr('sensor.cleveland_guardians','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.cleveland_guardians','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.cleveland_guardians','IN') %} {% if (state_attr('sensor.cleveland_guardians','team_score') | int) > (state_attr('sensor.cleveland_guardians','opponent_score') | int) %} @@ -562,6 +614,7 @@ {% endif %} {% if is_state('sensor.minnesota_twins','POST') %} {% set date = state_attr('sensor.minnesota_twins','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %} "The Minnesota Twins won their game today against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','team_score') }} to {{ state_attr('sensor.minnesota_twins','opponent_score') }}. " @@ -569,6 +622,13 @@ "The Minnesota Twins lost their game today against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','opponent_score') }} to {{ state_attr('sensor.minnesota_twins','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.minnesota_twins','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %} + "The Minnesota Twins won their game yesterday against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','team_score') }} to {{ state_attr('sensor.minnesota_twins','opponent_score') }}. " + {% else %} + "The Minnesota Twins lost their game yesterday against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','opponent_score') }} to {{ state_attr('sensor.minnesota_twins','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.minnesota_twins','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.minnesota_twins','IN') %} {% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %} @@ -581,6 +641,7 @@ {% endif %} {% if is_state('sensor.los_angeles_dodgers','POST') %} {% set date = state_attr('sensor.los_angeles_dodgers','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %} "The Los Angeles Dodgers won their game today against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','team_score') }} to {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }}. " @@ -588,6 +649,13 @@ "The Los Angeles Dodgers lost their game today against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }} to {{ state_attr('sensor.los_angeles_dodgers','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.los_angeles_dodgers','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %} + "The Los Angeles Dodgers won their game yesterday against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','team_score') }} to {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }}. " + {% else %} + "The Los Angeles Dodgers lost their game yesterday against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }} to {{ state_attr('sensor.los_angeles_dodgers','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.los_angeles_dodgers','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.los_angeles_dodgers','IN') %} {% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %} diff --git a/templates/speech/morning_briefing.yaml b/templates/speech/morning_briefing.yaml index 07cddb9..9109e85 100644 --- a/templates/speech/morning_briefing.yaml +++ b/templates/speech/morning_briefing.yaml @@ -231,6 +231,111 @@ {% endif %}

+

+ {% if is_state('sensor.michigan_wolverines','POST') %} + {% set date = state_attr('sensor.michigan_wolverines','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.michigan_wolverines','team_score') | int) > (state_attr('sensor.michigan_wolverines','opponent_score') | int) %} + "The Michigan Wolverines won their game yesterday against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','team_score') }} to {{ state_attr('sensor.michigan_wolverines','opponent_score') }}. " + {% else %} + "The Michigan Wolverines lost their game yesterday against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','opponent_score') }} to {{ state_attr('sensor.michigan_wolverines','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.michigan_wolverines','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} + {% if is_state('sensor.ohio_state_buckeyes','POST') %} + {% if state_attr('sensor.ohio_state_buckeyes','opponent_abbr') not in ['MICH'] %} + {% set date = state_attr('sensor.ohio_state_buckeyes','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.ohio_state_buckeyes','team_score') | int) > (state_attr('sensor.ohio_state_buckeyes','opponent_score') | int) %} + "The Ohio State Buckeyes won their game yesterday against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','team_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }}. " + {% else %} + "The Ohio State Buckeyes lost their game yesterday against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.ohio_state_buckeyes','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} + {% endif %} + {% if is_state('sensor.toledo_rockets','POST') %} + {% set date = state_attr('sensor.toledo_rockets','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %} + "The Toledo Rockets won their game yesterday against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','team_score') }} to {{ state_attr('sensor.toledo_rockets','opponent_score') }}. " + {% else %} + "The Toledo Rockets lost their game yesterday against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','opponent_score') }} to {{ state_attr('sensor.toledo_rockets','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.toledo_rockets','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} + {% if is_state('sensor.minnesota_vikings','POST') %} + {% set date = state_attr('sensor.minnesota_vikings','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.minnesota_vikings','team_score') | int) > (state_attr('sensor.minnesota_vikings','opponent_score') | int) %} + "The Minnesota Vikings won their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " + {% elif (state_attr('sensor.minnesota_vikings','team_score') | int) == state_attr('sensor.minnesota_vikings','opponent_score') | int %} + "The Minnesota Vikings tied in their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " + {% else %} + "The Minnesota Vikings lost their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','opponent_score') }} to {{ state_attr('sensor.minnesota_vikings','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.minnesota_vikings','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} + {% if is_state('sensor.san_francisco_49ers','POST') %} + {% set date = state_attr('sensor.san_francisco_49ers','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %} + "The San Francisco 49ers won their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " + {% elif (state_attr('sensor.san_francisco_49ers','team_score') | int) == state_attr('sensor.san_francisco_49ers','opponent_score') | int %} + "The San Francisco 49ers tied in their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " + {% else %} + "The San Francisco 49ers lost their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','opponent_score') }} to {{ state_attr('sensor.san_francisco_49ers','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.san_francisco_49ers','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} + {% if is_state('sensor.cleveland_guardians','POST') %} + {% set date = state_attr('sensor.cleveland_guardians','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.cleveland_guardians','team_score') | int) > (state_attr('sensor.cleveland_guardians','opponent_score') | int) %} + "The Cleveland Guardians won their game yesterday against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','team_score') }} to {{ state_attr('sensor.cleveland_guardians','opponent_score') }}. " + {% else %} + "The Cleveland Guardians lost their game yesterday against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','opponent_score') }} to {{ state_attr('sensor.cleveland_guardians','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.cleveland_guardians','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} + {% if is_state('sensor.minnesota_twins','POST') %} + {% set date = state_attr('sensor.minnesota_twins','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %} + "The Minnesota Twins won their game yesterday against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','team_score') }} to {{ state_attr('sensor.minnesota_twins','opponent_score') }}. " + {% else %} + "The Minnesota Twins lost their game yesterday against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','opponent_score') }} to {{ state_attr('sensor.minnesota_twins','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.minnesota_twins','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} + {% if is_state('sensor.los_angeles_dodgers','POST') %} + {% set date = state_attr('sensor.los_angeles_dodgers','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} + {% if yday == date %} + {% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %} + "The Los Angeles Dodgers won their game yesterday against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','team_score') }} to {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }}. " + {% else %} + "The Los Angeles Dodgers lost their game yesterday against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }} to {{ state_attr('sensor.los_angeles_dodgers','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.los_angeles_dodgers','team_record') | replace("-"," and ") }} on the season. " + {% endif %} + {% endif %} +

+

Here is a random dad joke {{ states('sensor.random_joke') }}

diff --git a/templates/speech/nightly_briefing.yaml b/templates/speech/nightly_briefing.yaml index e3a7a2b..8f312cd 100644 --- a/templates/speech/nightly_briefing.yaml +++ b/templates/speech/nightly_briefing.yaml @@ -142,6 +142,7 @@

{% if is_state('sensor.michigan_wolverines','POST') %} {% set date = state_attr('sensor.michigan_wolverines','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.michigan_wolverines','team_score') | int) > (state_attr('sensor.michigan_wolverines','opponent_score') | int) %} "The Michigan Wolverines won their game today against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','team_score') }} to {{ state_attr('sensor.michigan_wolverines','opponent_score') }}. " @@ -149,6 +150,13 @@ "The Michigan Wolverines lost their game today against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','opponent_score') }} to {{ state_attr('sensor.michigan_wolverines','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.michigan_wolverines','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.michigan_wolverines','team_score') | int) > (state_attr('sensor.michigan_wolverines','opponent_score') | int) %} + "The Michigan Wolverines won their game yesterday against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','team_score') }} to {{ state_attr('sensor.michigan_wolverines','opponent_score') }}. " + {% else %} + "The Michigan Wolverines lost their game yesterday against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} by a score of {{ state_attr('sensor.michigan_wolverines','opponent_score') }} to {{ state_attr('sensor.michigan_wolverines','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.michigan_wolverines','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.michigan_wolverines','IN') %} {% if (state_attr('sensor.michigan_wolverines','team_score') | int) > (state_attr('sensor.michigan_wolverines','opponent_score') | int) %} @@ -162,6 +170,7 @@ {% if is_state('sensor.ohio_state_buckeyes','POST') %} {% if state_attr('sensor.ohio_state_buckeyes','opponent_abbr') not in ['MICH'] %} {% set date = state_attr('sensor.ohio_state_buckeyes','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.ohio_state_buckeyes','team_score') | int) > (state_attr('sensor.ohio_state_buckeyes','opponent_score') | int) %} "The Ohio State Buckeyes won their game today against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','team_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }}. " @@ -169,6 +178,13 @@ "The Ohio State Buckeyes lost their game today against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.ohio_state_buckeyes','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.ohio_state_buckeyes','team_score') | int) > (state_attr('sensor.ohio_state_buckeyes','opponent_score') | int) %} + "The Ohio State Buckeyes won their game yesterday against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','team_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }}. " + {% else %} + "The Ohio State Buckeyes lost their game yesterday against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} by a score of {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.ohio_state_buckeyes','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% endif %} {% elif is_state('sensor.ohio_state_buckeyes','IN') %} @@ -184,6 +200,7 @@ {% endif %} {% if is_state('sensor.toledo_rockets','POST') %} {% set date = state_attr('sensor.toledo_rockets','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %} "The Toledo Rockets won their game today against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','team_score') }} to {{ state_attr('sensor.toledo_rockets','opponent_score') }}. " @@ -191,6 +208,13 @@ "The Toledo Rockets lost their game today against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','opponent_score') }} to {{ state_attr('sensor.toledo_rockets','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.toledo_rockets','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %} + "The Toledo Rockets won their game yesterday against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','team_score') }} to {{ state_attr('sensor.toledo_rockets','opponent_score') }}. " + {% else %} + "The Toledo Rockets lost their game yesterday against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} by a score of {{ state_attr('sensor.toledo_rockets','opponent_score') }} to {{ state_attr('sensor.toledo_rockets','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.toledo_rockets','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.toledo_rockets','IN') %} {% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %} @@ -203,6 +227,7 @@ {% endif %} {% if is_state('sensor.minnesota_vikings','POST') %} {% set date = state_attr('sensor.minnesota_vikings','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.minnesota_vikings','team_score') | int) > (state_attr('sensor.minnesota_vikings','opponent_score') | int) %} "The Minnesota Vikings won their game today against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " @@ -212,6 +237,15 @@ "The Minnesota Vikings lost their game today against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','opponent_score') }} to {{ state_attr('sensor.minnesota_vikings','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.minnesota_vikings','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.minnesota_vikings','team_score') | int) > (state_attr('sensor.minnesota_vikings','opponent_score') | int) %} + "The Minnesota Vikings won their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " + {% elif (state_attr('sensor.minnesota_vikings','team_score') | int) == state_attr('sensor.minnesota_vikings','opponent_score') | int %} + "The Minnesota Vikings tied in their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. " + {% else %} + "The Minnesota Vikings lost their game yesterday against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_vikings','opponent_score') }} to {{ state_attr('sensor.minnesota_vikings','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.minnesota_vikings','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.minnesota_vikings','IN') %} {% if (state_attr('sensor.minnesota_vikings','team_score') | int) > (state_attr('sensor.minnesota_vikings','opponent_score') | int) %} @@ -224,6 +258,7 @@ {% endif %} {% if is_state('sensor.san_francisco_49ers','POST') %} {% set date = state_attr('sensor.san_francisco_49ers','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %} "The San Francisco 49ers won their game today against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " @@ -233,6 +268,15 @@ "The San Francisco 49ers lost their game today against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','opponent_score') }} to {{ state_attr('sensor.san_francisco_49ers','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.san_francisco_49ers','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %} + "The San Francisco 49ers won their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " + {% elif (state_attr('sensor.san_francisco_49ers','team_score') | int) == state_attr('sensor.san_francisco_49ers','opponent_score') | int %} + "The San Francisco 49ers tied in their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','team_score') }} to {{ state_attr('sensor.san_francisco_49ers','opponent_score') }}. " + {% else %} + "The San Francisco 49ers lost their game yesterday against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} by a score of {{ state_attr('sensor.san_francisco_49ers','opponent_score') }} to {{ state_attr('sensor.san_francisco_49ers','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.san_francisco_49ers','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.san_francisco_49ers','IN') %} {% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %} @@ -245,6 +289,7 @@ {% endif %} {% if is_state('sensor.cleveland_guardians','POST') %} {% set date = state_attr('sensor.cleveland_guardians','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.cleveland_guardians','team_score') | int) > (state_attr('sensor.cleveland_guardians','opponent_score') | int) %} "The Cleveland Guardians won their game today against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','team_score') }} to {{ state_attr('sensor.cleveland_guardians','opponent_score') }}. " @@ -252,6 +297,13 @@ "The Cleveland Guardians lost their game today against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','opponent_score') }} to {{ state_attr('sensor.cleveland_guardians','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.cleveland_guardians','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.cleveland_guardians','team_score') | int) > (state_attr('sensor.cleveland_guardians','opponent_score') | int) %} + "The Cleveland Guardians won their game yesterday against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','team_score') }} to {{ state_attr('sensor.cleveland_guardians','opponent_score') }}. " + {% else %} + "The Cleveland Guardians lost their game yesterday against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} by a score of {{ state_attr('sensor.cleveland_guardians','opponent_score') }} to {{ state_attr('sensor.cleveland_guardians','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.cleveland_guardians','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.cleveland_guardians','IN') %} {% if (state_attr('sensor.cleveland_guardians','team_score') | int) > (state_attr('sensor.cleveland_guardians','opponent_score') | int) %} @@ -264,6 +316,7 @@ {% endif %} {% if is_state('sensor.minnesota_twins','POST') %} {% set date = state_attr('sensor.minnesota_twins','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %} "The Minnesota Twins won their game today against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','team_score') }} to {{ state_attr('sensor.minnesota_twins','opponent_score') }}. " @@ -271,6 +324,13 @@ "The Minnesota Twins lost their game today against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','opponent_score') }} to {{ state_attr('sensor.minnesota_twins','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.minnesota_twins','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %} + "The Minnesota Twins won their game yesterday against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','team_score') }} to {{ state_attr('sensor.minnesota_twins','opponent_score') }}. " + {% else %} + "The Minnesota Twins lost their game yesterday against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} by a score of {{ state_attr('sensor.minnesota_twins','opponent_score') }} to {{ state_attr('sensor.minnesota_twins','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.minnesota_twins','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.minnesota_twins','IN') %} {% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %} @@ -283,6 +343,7 @@ {% endif %} {% if is_state('sensor.los_angeles_dodgers','POST') %} {% set date = state_attr('sensor.los_angeles_dodgers','date') | as_timestamp | timestamp_custom('%m-%d') %} + {% set yday = (as_timestamp(now()) - (24*3600)) | timestamp_custom('%m-%d') %} {% if date == now().strftime('%m-%d') %} {% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %} "The Los Angeles Dodgers won their game today against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','team_score') }} to {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }}. " @@ -290,6 +351,13 @@ "The Los Angeles Dodgers lost their game today against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }} to {{ state_attr('sensor.los_angeles_dodgers','team_score') }}. " {% endif %} "This brings their record to {{ state_attr('sensor.los_angeles_dodgers','team_record') | replace("-"," and ") }} on the season. " + {% elif yday == date %} + {% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %} + "The Los Angeles Dodgers won their game yesterday against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','team_score') }} to {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }}. " + {% else %} + "The Los Angeles Dodgers lost their game yesterday against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} by a score of {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }} to {{ state_attr('sensor.los_angeles_dodgers','team_score') }}. " + {% endif %} + "This brings their record to {{ state_attr('sensor.los_angeles_dodgers','team_record') | replace("-"," and ") }} on the season. " {% endif %} {% elif is_state('sensor.los_angeles_dodgers','IN') %} {% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %}