Implemented sports template macros in briefings

This commit is contained in:
2023-04-05 21:03:43 -04:00
parent 2e9497ae6d
commit 6e212c62bc
4 changed files with 115 additions and 843 deletions

View File

@ -98,300 +98,60 @@
</p>
<p>
{% from 'sports.jinja' import sports_pregame, sports_main %}
{% if is_state('input_boolean.sports_updates','on') %}
{% if is_state('sensor.michigan_wolverines','PRE') %}
{% set date = state_attr('sensor.michigan_wolverines','date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The Michigan Wolverines will be playing today against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} at {{ state_attr('sensor.michigan_wolverines','venue') }}. "
"Kickoff will be at {{ state_attr('sensor.michigan_wolverines','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
{{ sports_pregame('sensor.michigan_wolverines') }}
{% endif %}
{% if is_state('sensor.ohio_state_buckeyes','PRE') %}
{% 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') %}
{% if date == now().strftime('%m-%d') %}
"The Ohio State Buckeyes will be playing today against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} at {{ state_attr('sensor.ohio_state_buckeyes','venue') }}. "
"Kickoff will be at {{ state_attr('sensor.ohio_state_buckeyes','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
{{ sports_pregame('sensor.ohio_state_buckeyes') }}
{% endif %}
{% if is_state('sensor.toledo_rockets','PRE') %}
{% if state_attr('sensor.toledo_rockets','opponent_abbr') not in ['OSU','MICH'] %}
{% set date = state_attr('sensor.toledo_rockets','date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The Toledo Rockets will be playing today against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} at {{ state_attr('sensor.toledo_rockets','venue') }}. "
"Kickoff will be at {{ state_attr('sensor.toledo_rockets','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
{{ sports_pregame('sensor.toledo_rockets') }}
{% endif %}
{% if is_state('sensor.minnesota_vikings','PRE') %}
{% set date = state_attr('sensor.minnesota_vikings','date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The Minnesota Vikings will be playing today against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} at {{ state_attr('sensor.minnesota_vikings','venue') }}. "
"Kickoff will be at {{ state_attr('sensor.minnesota_vikings','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
{{ sports_pregame('sensor.minnesota_vikings') }}
{% endif %}
{% if is_state('sensor.san_francisco_49ers','PRE') %}
{% if state_attr('sensor.san_francisco_49ers','opponent_abbr') not in ['MIN'] %}
{% set date = state_attr('sensor.san_francisco_49ers','date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The San Francisco 49ers will be playing today against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} at {{ state_attr('sensor.san_francisco_49ers','venue') }}. "
"Kickoff will be at {{ state_attr('sensor.san_francisco_49ers','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
{{ sports_pregame('sensor.san_francisco_49ers') }}
{% endif %}
{% if is_state('sensor.cleveland_guardians','PRE') %}
{% set date = state_attr('sensor.cleveland_guardians','date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The Cleveland Guardians will be playing today against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} at {{ state_attr('sensor.cleveland_guardians','venue') }}. "
"First pitch will be at {{ state_attr('sensor.cleveland_guardians','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
{{ sports_pregame('sensor.cleveland_guardians') }}
{% endif %}
{% if is_state('sensor.minnesota_twins','PRE') %}
{% if state_attr('sensor.minnesota_twins','opponent_abbr') not in ['CLE','LAD'] %}
{% set date = state_attr('sensor.minnesota_twins','date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The Minnesota Twins will be playing today against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} at {{ state_attr('sensor.minnesota_twins','venue') }}. "
"First pitch will be at {{ state_attr('sensor.minnesota_twins','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
{{ sports_pregame('sensor.minnesota_twins') }}
{% endif %}
{% if is_state('sensor.los_angeles_dodgers','PRE') %}
{% if state_attr('sensor.los_angeles_dodgers','opponent_abbr') not in ['CLE'] %}
{% set date = state_attr('sensor.los_angeles_dodgers','date') | as_timestamp | timestamp_custom('%m-%d') %}
{% if date == now().strftime('%m-%d') %}
"The Los Angeles Dodgers will be playing today against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} at {{ state_attr('sensor.los_angeles_dodgers','venue') }}. "
"First pitch will be at {{ state_attr('sensor.los_angeles_dodgers','date') | as_timestamp | timestamp_custom('%I:%M %p') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
{{ sports_pregame('sensor.los_angeles_dodgers') }}
{% endif %}
{% endif %}
</p>
<p>
{% if is_state('input_boolean.sports_updates','on') %}
{% 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') }}. "
{% else %}
"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) %}
"The Michigan Wolverines are currently winning their game against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} with a score of {{ state_attr('sensor.michigan_wolverines','team_score') }} to {{ state_attr('sensor.michigan_wolverines','opponent_score') }}. "
{% elif (state_attr('sensor.michigan_wolverines','team_score') | int) == (state_attr('sensor.michigan_wolverines','opponent_score') | int) %}
"The Michigan Wolverines are currently tied in their game against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} with a score of {{ state_attr('sensor.michigan_wolverines','team_score') }} to {{ state_attr('sensor.michigan_wolverines','opponent_score') }}. "
{% else %}
"The Michigan Wolverines are currently losing their game against the {{ state_attr('sensor.michigan_wolverines','opponent_name') }} with a score of {{ state_attr('sensor.michigan_wolverines','opponent_score') }} to {{ state_attr('sensor.michigan_wolverines','team_score') }}. "
{% endif %}
{% if is_state('binary_sensor.michigan_wolverines_inhibit','off') %}
{{ sports_main('sensor.michigan_wolverines') }}
{% 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 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') }}. "
{% else %}
"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') %}
{% if state_attr('sensor.ohio_state_buckeyes','opponent_abbr') not in ['MICH'] %}
{% if (state_attr('sensor.ohio_state_buckeyes','team_score') | int) > (state_attr('sensor.ohio_state_buckeyes','opponent_score') | int) %}
"The Ohio State Buckeyes are currently winning their game against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} with a score of {{ state_attr('sensor.ohio_state_buckeyes','team_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }}. "
{% elif (state_attr('sensor.ohio_state_buckeyes','team_score') | int) == (state_attr('sensor.ohio_state_buckeyes','opponent_score') | int) %}
"The Ohio State Buckeyes are currently tied in their game against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} with 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 are currently losing their game against the {{ state_attr('sensor.ohio_state_buckeyes','opponent_name') }} with a score of {{ state_attr('sensor.ohio_state_buckeyes','opponent_score') }} to {{ state_attr('sensor.ohio_state_buckeyes','team_score') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.ohio_state_buckeyes_inhibit','off') %}
{{ sports_main('sensor.ohio_state_buckeyes') }}
{% endif %}
{% if is_state('sensor.toledo_rockets','POST') %}
{% if state_attr('sensor.toledo_rockets','opponent_abbr') not in ['OSU','MICH'] %}
{% 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') }}. "
{% else %}
"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 %}
{% endif %}
{% elif is_state('sensor.toledo_rockets','IN') %}
{% if state_attr('sensor.toledo_rockets','opponent_abbr') not in ['OSU','MICH'] %}
{% if (state_attr('sensor.toledo_rockets','team_score') | int) > (state_attr('sensor.toledo_rockets','opponent_score') | int) %}
"The Toledo Rockets are currently winning their game against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} with a score of {{ state_attr('sensor.toledo_rockets','team_score') }} to {{ state_attr('sensor.toledo_rockets','opponent_score') }}. "
{% elif (state_attr('sensor.toledo_rockets','team_score') | int) == (state_attr('sensor.toledo_rockets','opponent_score') | int) %}
"The Toledo Rockets are currently tied in their game against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} with a score of {{ state_attr('sensor.toledo_rockets','team_score') }} to {{ state_attr('sensor.toledo_rockets','opponent_score') }}. "
{% else %}
"The Toledo Rockets are currently losing their game against the {{ state_attr('sensor.toledo_rockets','opponent_name') }} with a score of {{ state_attr('sensor.toledo_rockets','opponent_score') }} to {{ state_attr('sensor.toledo_rockets','team_score') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.toledo_rockets_inhibit','off') %}
{{ sports_main('sensor.toledo_rockets') }}
{% 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') }}. "
{% elif (state_attr('sensor.minnesota_vikings','team_score') | int) == state_attr('sensor.minnesota_vikings','opponent_score') | int %}
"The Minnesota Vikings tied in 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') }}. "
{% else %}
"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) %}
"The Minnesota Vikings are currently winning their game against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} with 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 are currently tied in their game against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} with a score of {{ state_attr('sensor.minnesota_vikings','team_score') }} to {{ state_attr('sensor.minnesota_vikings','opponent_score') }}. "
{% else %}
"The Minnesota Vikings are currently losing their game against the {{ state_attr('sensor.minnesota_vikings','opponent_name') }} with a score of {{ state_attr('sensor.minnesota_vikings','opponent_score') }} to {{ state_attr('sensor.minnesota_vikings','team_score') }}. "
{% endif %}
{% if is_state('binary_sensor.minnesota_vikings_inhibit','off') %}
{{ sports_main('sensor.minnesota_vikings') }}
{% endif %}
{% if is_state('sensor.san_francisco_49ers','POST') %}
{% if state_attr('sensor.san_francisco_49ers','opponent_abbr') not in ['MIN'] %}
{% 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') }}. "
{% 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 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') }}. "
{% else %}
"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 %}
{% endif %}
{% elif is_state('sensor.san_francisco_49ers','IN') %}
{% if state_attr('sensor.san_francisco_49ers','opponent_abbr') not in ['MIN'] %}
{% if (state_attr('sensor.san_francisco_49ers','team_score') | int) > (state_attr('sensor.san_francisco_49ers','opponent_score') | int) %}
"The San Francisco 49ers are currently winning their game against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} with 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 are currently tied in their game against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} with 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 are currently losing their game against the {{ state_attr('sensor.san_francisco_49ers','opponent_name') }} with a score of {{ state_attr('sensor.san_francisco_49ers','opponent_score') }} to {{ state_attr('sensor.san_francisco_49ers','team_score') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.san_francisco_49ers_inhibit','off') %}
{{ sports_main('sensor.san_francisco_49ers') }}
{% 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') }}. "
{% else %}
"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. "
{% 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) %}
"The Cleveland Guardians are currently winning their game against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} with a score of {{ state_attr('sensor.cleveland_guardians','team_score') }} to {{ state_attr('sensor.cleveland_guardians','opponent_score') }}. "
{% elif (state_attr('sensor.cleveland_guardians','team_score') | int) == (state_attr('sensor.cleveland_guardians','opponent_score') | int) %}
"The Cleveland Guardians are currently tied in their game against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} with a score of {{ state_attr('sensor.cleveland_guardians','team_score') }} to {{ state_attr('sensor.cleveland_guardians','opponent_score') }}. "
{% else %}
"The Cleveland Guardians are currently losing their game against the {{ state_attr('sensor.cleveland_guardians','opponent_name') }} with a score of {{ state_attr('sensor.cleveland_guardians','opponent_score') }} to {{ state_attr('sensor.cleveland_guardians','team_score') }}. "
{% endif %}
{% if is_state('binary_sensor.cleveland_guardians_inhibit','off') %}
{{ sports_main('sensor.cleveland_guardians') }}
{% endif %}
{% if is_state('sensor.minnesota_twins','POST') %}
{% if state_attr('sensor.minnesota_twins','opponent_abbr') not in ['CLE','LAD'] %}
{% 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') }}. "
{% else %}
"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. "
{% endif %}
{% endif %}
{% elif is_state('sensor.minnesota_twins','IN') %}
{% if state_attr('sensor.minnesota_twins','opponent_abbr') not in ['CLE','LAD'] %}
{% if (state_attr('sensor.minnesota_twins','team_score') | int) > (state_attr('sensor.minnesota_twins','opponent_score') | int) %}
"The Minnesota Twins are currently winning their game against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} with a score of {{ state_attr('sensor.minnesota_twins','team_score') }} to {{ state_attr('sensor.minnesota_twins','opponent_score') }}. "
{% elif (state_attr('sensor.minnesota_twins','team_score') | int) == (state_attr('sensor.minnesota_twins','opponent_score') | int) %}
"The Minnesota Twins are currently tied in their game against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} with a score of {{ state_attr('sensor.minnesota_twins','team_score') }} to {{ state_attr('sensor.minnesota_twins','opponent_score') }}. "
{% else %}
"The Minnesota Twins are currently losing their game against the {{ state_attr('sensor.minnesota_twins','opponent_name') }} with a score of {{ state_attr('sensor.minnesota_twins','opponent_score') }} to {{ state_attr('sensor.minnesota_twins','team_score') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.minnesota_twins_inhibit','off') %}
{{ sports_main('sensor.minnesota_twins') }}
{% endif %}
{% if is_state('sensor.los_angeles_dodgers','POST') %}
{% if state_attr('sensor.los_angeles_dodgers','opponent_abbr') not in ['MIN'] %}
{% 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') }}. "
{% else %}
"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. "
{% endif %}
{% endif %}
{% elif is_state('sensor.los_angeles_dodgers','IN') %}
{% if state_attr('sensor.los_angeles_dodgers','opponent_abbr') not in ['MIN'] %}
{% if (state_attr('sensor.los_angeles_dodgers','team_score') | int) > (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %}
"The Los Angeles Dodgers are currently winning their game against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} with a score of {{ state_attr('sensor.los_angeles_dodgers','team_score') }} to {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }}. "
{% elif (state_attr('sensor.los_angeles_dodgers','team_score') | int) == (state_attr('sensor.los_angeles_dodgers','opponent_score') | int) %}
"The Los Angeles Dodgers are currently tied in their game against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} with 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 are currently losing their game against the {{ state_attr('sensor.los_angeles_dodgers','opponent_name') }} with a score of {{ state_attr('sensor.los_angeles_dodgers','opponent_score') }} to {{ state_attr('sensor.los_angeles_dodgers','team_score') }}. "
{% endif %}
{% endif %}
{% if is_state('binary_sensor.los_angeles_dodgers_inhibit','off') %}
{{ sports_main('sensor.los_angeles_dodgers') }}
{% endif %}
{% endif %}
</p>