From 6e212c62bcf5710f9221a623407eaf301aeaf74f Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Wed, 5 Apr 2023 21:03:43 -0400 Subject: [PATCH] Implemented sports template macros in briefings --- packages/sports.yaml | 40 ++-- templates/speech/daily_briefing.yaml | 306 +++---------------------- templates/speech/morning_briefing.yaml | 306 +++---------------------- templates/speech/nightly_briefing.yaml | 306 +++---------------------- 4 files changed, 115 insertions(+), 843 deletions(-) diff --git a/packages/sports.yaml b/packages/sports.yaml index 67afc7e..659768a 100644 --- a/packages/sports.yaml +++ b/packages/sports.yaml @@ -11,48 +11,40 @@ template: - name: Michigan Wolverines Inhibit unique_id: f361b30c-1771-41b3-85ff-ef1e0b6be59c state: > - {% if state_attr('sensor.michigan_wolverines','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.michigan_wolverines','kickoff_in') }} - {% endif %} + {% from 'sports.jinja' import sports_inhibit %} + {{ sports_inhibit('sensor.michigan_wolverines') }} - name: Ohio State Buckeyes Inhibit unique_id: d5359cb4-427a-46f8-99d6-4313530fde81 state: > - {% if state_attr('sensor.ohio_state_buckeyes','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.ohio_state_buckeyes','kickoff_in') }} - {% endif %} + {% from 'sports.jinja' import sports_inhibit %} + {{ state_attr('sensor.ohio_state_buckeyes','opponent_abbr') in ['MICH'] or sports_inhibit('sensor.ohio_state_buckeyes') }} - name: Toledo Rockets Inhibit unique_id: 1f84d3f3-a06e-4745-a593-c21fe3504072 state: > - {% if state_attr('sensor.toledo_rockets','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.toledo_rockets','kickoff_in') }} - {% endif %} + {% from 'sports.jinja' import sports_inhibit %} + {{ state_attr('sensor.toledo_rockets','opponent_abbr') in ['OSU','MICH'] or sports_inhibit('sensor.toledo_rockets') }} - name: Minnesota Vikings Inhibit unique_id: ea60c987-a95b-4024-a9c7-1bc6975e07e2 state: > - {% if state_attr('sensor.minnesota_vikings','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.minnesota_vikings','kickoff_in') }} - {% endif %} + {% from 'sports.jinja' import sports_inhibit %} + {{ sports_inhibit('sensor.minnesota_vikings') }} - name: San Francisco 49ers Inhibit unique_id: ce2441fa-09d6-4afc-b350-fee3745cdb50 state: > - {% if state_attr('sensor.san_francisco_49ers','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.san_francisco_49ers','kickoff_in') }} - {% endif %} + {% from 'sports.jinja' import sports_inhibit %} + {{ state_attr('sensor.toledo_rockets','opponent_abbr') in ['MIN'] or sports_inhibit('sensor.san_francisco_49ers') }} - name: Cleveland Guardians Inhibit unique_id: b0980d47-d762-4f23-97b1-9e88da729d8f state: > - {% if state_attr('sensor.cleveland_guardians','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.cleveland_guardians','kickoff_in') }} - {% endif %} + {% from 'sports.jinja' import sports_inhibit %} + {{ sports_inhibit('sensor.cleveland_guardians') }} - name: Minnesota Twins Inhibit unique_id: 2987ae95-f55d-4994-b9dd-018278d2f5ad state: > - {% if state_attr('sensor.minnesota_twins','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.minnesota_twins','kickoff_in') }} - {% endif %} + {% from 'sports.jinja' import sports_inhibit %} + {{ state_attr('sensor.minnesota_twins','opponent_abbr') in ['CLE','LAD'] or sports_inhibit('sensor.minnesota_twins') }} - name: Los Angeles Dodgers Inhibit unique_id: 2c6aae6e-eff6-46e5-bee9-311f9bbc0c0e state: > - {% if state_attr('sensor.los_angeles_dodgers','kickoff_in') %} - {{ ('months' or 'weeks') in state_attr('sensor.los_angeles_dodgers','kickoff_in') }} - {% endif %} \ No newline at end of file + {% from 'sports.jinja' import sports_inhibit %} + {{ state_attr('sensor.los_angeles_dodgers','opponent_abbr') in ['CLE'] or sports_inhibit('sensor.los_angeles_dodgers') }} \ No newline at end of file diff --git a/templates/speech/daily_briefing.yaml b/templates/speech/daily_briefing.yaml index c5b4bda..e77711a 100644 --- a/templates/speech/daily_briefing.yaml +++ b/templates/speech/daily_briefing.yaml @@ -355,300 +355,60 @@

+ {% 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 %}

{% 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 %}

diff --git a/templates/speech/morning_briefing.yaml b/templates/speech/morning_briefing.yaml index 967fce6..c25a947 100644 --- a/templates/speech/morning_briefing.yaml +++ b/templates/speech/morning_briefing.yaml @@ -155,300 +155,60 @@

+ {% 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 %}

{% 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 %}

diff --git a/templates/speech/nightly_briefing.yaml b/templates/speech/nightly_briefing.yaml index 738dad7..f18a269 100644 --- a/templates/speech/nightly_briefing.yaml +++ b/templates/speech/nightly_briefing.yaml @@ -98,300 +98,60 @@

+ {% 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 %}

{% 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 %}